Infarction 503 Posting Virtuoso

Because they typically require little thought to add to the thread of largely meaningless posts. There are some exceptions...

Infarction 503 Posting Virtuoso

But isn't kinetic energy 1/2 mv^2?

Maybe this is why I did so bad in physics years ago... :sad:

Infarction 503 Posting Virtuoso

[tex]2^{\lfloor\log_2{2401}\rfloor + 1} = 4096[/tex]

Infarction 503 Posting Virtuoso

Hm... I got 21.22m/s... then again, I haven't done physics in a long time and may have mis-remembered something along the way... (that was for the first one btw)

Infarction 503 Posting Virtuoso

Actually, laptops used to be prone to overheating. Especially the ones that had powerful desktop CPUs in them (e.g. Pentium 4s instead of Pentium Ms). Because they were still somewhat of a novelty and due to their convenience when they didn't overheat, they still sold quite well. Lately though, CPU design has taken energy costs and heat output into account more and so we have less heat and better methods of heat dissipation.

Infarction 503 Posting Virtuoso

Does that even matter?

If you were worried about details, it would matter. The passengers were part of the energy system, and stopping them would require energy as well. If passengers from one vehicle were to continue flying through the windshield, it would change the amount of energy involved in the collision, and would change the result a bit.

Infarction 503 Posting Virtuoso

But the universe is only 30 seconds old, how could he have posted it minutes ago? :p

Infarction 503 Posting Virtuoso

I leave mine on all the time. Doesn't get particularly warm unless I'm running cpu intensive stuff, but even then the fans keep up fine. That's what they're made for, afterall.

Infarction 503 Posting Virtuoso

Some people have argued that ++i yields more efficient assembly code. When I checked, they were the same. In this situation, it doesn't matter.

Infarction 503 Posting Virtuoso

I'd probably set up a computer as a lowly little server. And/or share the connection with my neighbors, depending on the cost. However, I sincerely doubt that such a connection will be available for residences in the US for a long time. It would take an enormous backbone network to support several million people using 100Mbps networks from their homes.

Infarction 503 Posting Virtuoso

Please don't make duplicate threads on the same topic, it just wastes people's time.

Infarction 503 Posting Virtuoso

How are you currently sorting them?

Infarction 503 Posting Virtuoso

I just wrote this right now so there might be a few errors. :cheesy:

<snip>

Rather than syntax erros, your implementation seems really inefficient. Why bother saving the values if you're just going to print them? Also, the OP would be dealing with doubles. Comparing an int to 0.7 is the same as comparing it to 0. ;)

Infarction 503 Posting Virtuoso

Post what you have so far and we'll try to help you fix it up ;)

Infarction 503 Posting Virtuoso

The URL was likely snipped by a mod. It's a common habit to avoid spammer links (just in case).

@OP: If you're learning C++, have you already began working on your OS? Your post sounded like it was completed already.

Infarction 503 Posting Virtuoso

vijayan's solution should be correct. There's a few things different between his and yours, though, which are important. First, his parameter takes a const object. This allows you to have a const Node on the right side of the expression. Second, he uses the pass-by-reference mechanism (the &) to avoid copying the node unnecessarily. Third, and the solution to your question, is the const at the end of the line which dictates that the function may be called for constant objects (which would be on the left-hand side).

Infarction 503 Posting Virtuoso

If this is in c++, you should look up some of the things made available in <iomanip>. The code won't be very neat, but you can eventually get it to output to pretty much any format. You might have to find out what the longest value for some columns are to make sure it all lines up correctly.

Infarction 503 Posting Virtuoso

And by seeing the number of replies it has got, you must have got a fair approximate of how *well* the idea was taken in by the members of Daniweb... ;)

Seriously, think of it this way. There are many people here who are not programmers or not involved in the technical stuff. They post for fun and relax in the Geek's Lounge. Now take away the post count of those members and where does that leave them -- nowwhere I guess. So, there would be no reason for them to post. If this reasoning is followed, the creative and lively spark of Daniweb would dry out and Daniweb would be "just another Tech forum"...

We're not saying to get rid of the games, but to separate it from the material that some of us self-declared "geekier" folks want to read and discuss. And if people are posting just to raise their post count... well, that's pretty lame at best (I'd call it spam, really).

Infarction 503 Posting Virtuoso

Seems like you're trying to do something wrong. :)

No, I'm pretty sure his demands are legit. There are times in a low-level application where you need to specify a certain address (MMIO is an example of this, albeit a poor one). He'll be just fine if he sets the addresses as he needs, so long as he double checks his memoy layout.

Infarction 503 Posting Virtuoso

This isn't tested, but it should give you the idea:

int* a = 0x8000;
int* b = 0x8000 + sizeof(int); // account for a
int* c = 0x8000 + 2*sizeof(int); // account for a and b
double* test = 0x8000 + 3*sizeof(int); // account for a,b,c
int* yetAnother = 0x8000 + 3*sizeof(int) + 10*sizeof(double); // etc...

Alternatively, you could hardcode direct addresses (0x8000, 0x8004, etc...), but you'd have to know the size of each type.

Infarction 503 Posting Virtuoso

If you know where you want the data, just create a global variable pointing to it. This of course assumes that you point it to a valid address, and you'll have to make sure they line up (and don't overlap) yourself.

Infarction 503 Posting Virtuoso

Can't say that I've had problems with it before. Must be bad luck :p

Infarction 503 Posting Virtuoso

I know nothing about WML. Sorry.

Infarction 503 Posting Virtuoso

Not quite, it's

minimum + rand() / (RAND_MAX / (maximum - minimum) + 1 );

To ensure proper distribution.

:twisted:
(sorry, I couldn't help it :mrgreen:)

Actually, according to this very enlightening read, you're all wrong...

(sorry, I couldn't help it either) :mrgreen:

Infarction 503 Posting Virtuoso

That's true, but a work-around could be possible. For example, if memory isn't an issue, one could use a wrapper struct to maintain the original value and the square
root of the value, sort by square root, and then return the original values in sorted order. Sounds like a bit of extra work, but I think it could make the time complexity requirement.

Infarction 503 Posting Virtuoso

hm... just an idea... what if you tried applying any of the otherwise O(n) algorithms, but took the sqrt of the data as you sorted it. That would cut out the polynomial range, leavning you from 0..N, which is then polynomial time. You'd have to make an extra run over the loop at the end to square everything back to it's actual value.

Infarction 503 Posting Virtuoso

<stuff about Geek Lounge>

Completely agree on this. I've almost stopped going to the Geek Lounge because it's filed with the same 5 word games and a few links each time. Every few days there'll be something interesting. Maybe we could have a play forum for the word games, and the geek lounge could be for random - but still geeky - topics?

<location of Databases>

I think databases is in a nice spot, given that so many web apps are largely database driven. I'll certainly acknowledge that databases are not solely for use in web applications, but that does seem to be a reasonable location.

Infarction 503 Posting Virtuoso

Basically,

what i have put in the post is a bare minimum of what i have, the encryption is a 1gig encryption, which takes about 2 seconds to encrypt and decrypt. As far as my compression algorithms go, were running about a 2mb compression algorithm for now because like you said, that will slow down the system, and a better algortihm is yet to be found. Also, the memmory mangement technique im using is far from lmitting, and proves to be worth while, as ive tried a sample database, with multiple fields, and 500 records, which comes to about 18meg. The file opens in seconds, and doesnt cause a flood of system resource failures, as it is unique to the point where it bypasses the memmory completely and communicates directily with the processor, like on a MAC.

1gig encryption? 2mb compression? What do those mean? Are you using a 8589934592 bit encryption key? This isn't making sense. Also, the 2 seconds to encrypt-decrypt: are those for each database query? If so, that is irrationally long, and would never survive in a production environment.

There is an API, but it is being developed as I go. A good reference would be the API for xBase 64 dbms. Further more, this dbms, is more of a db engine and front-end there of, rather than an editor for multiple formats, which is where the file formats come in.

I'd recommend you take a few weeks to design before you code. Developing an …

~s.o.s~ commented: Kids nowadays are in real need of reality check ;) - ~s.o.s~ +16
Infarction 503 Posting Virtuoso

No, it's exactly 1024. There is technically a difference between a megabyte (1000 MB = 1 GB) and a mebibyte (1024 MiB = 1 GiB), but that would make a much larger difference. I've had the same thing happen when I create partitions too, though, so it's probably something in the partitioning software. Is the 0.1GB that important?

Infarction 503 Posting Virtuoso

Well, we won't simply hand it to you. What have you tried? What code are you currently working with?

Infarction 503 Posting Virtuoso

1) Will your multi-dimensionalism come even close to SQL in terms of speed? How do you intend to implement it?
2) How will the performance of your arrays be? Why is this a better design?
3) Why do you need file formats in a DBMS?
4) Compression and encryption will only slow down a DBMS. Locking happens on any DBMS worth using.
5) T-SQL has at least 28 types that I counted. MySQL has at least 16.
6) That's a remarkably small number.
7) Also seems very limiting.
8) I don't know how big databases get, but that also sounds like a potentially limiting factor.
9) Most other DBMSs also have APIs in several languages
10) What is WAA?
11) Have you put any planning into a memory management system yet? How familiar are you with dealing with data that doesn't fit in RAM?

Not to be shooting you down too much, but you really haven't provided nearly enough information to make this project sounds usable, much less feasible.

Infarction 503 Posting Virtuoso

"HP: Most realistic prints you'll ever see"
"Hey, I need a hand with this paper jam"

Infarction 503 Posting Virtuoso

Well, in a normal case you'd be able to claim that radix sort, bucket sort, or counting sort (to name a couple) would run in O(n) time. But since they're all dependent on the range in some very small degree, seems like, the claim doesn't hold anymore.

Infarction 503 Posting Virtuoso

Since it does have the O(n log n) case, it wouldn't fit the requirements. And I've never seen an implementation of it outside of that paper... ;)

Infarction 503 Posting Virtuoso

I had it going once. I used grub, had it chainload the Windows boot manager, which then let me choose between XP and 2003. It was a very small hassle as I recall, but nothing particularly difficult.

Infarction 503 Posting Virtuoso

When you get an error with your code, please post that next time. Anyways, the error I got was that on line 19 you declare a Bev_Iterator* without having declared the class first. Put this line before the definition of the Beverage class:

class Bev_Iterator;

There maybe be other errors, I didn't check thoroughly.

[edit:] look like Ancient Dragon put a li'l more time into it ;)

Infarction 503 Posting Virtuoso

> 1. Can I install a Ubuntu on a HDD with a Partition with 75 % 25%, and have linux on the 25% and a copy of Windows on the 75%?
Yes, but it's possible that you'll have to re-install Windows.

> 2. Is there any important software that I should get??
Depends on what you'll be doing. There's a few lists of applications on Windows and their corresponding apps on Linux that you can dig up somewhere.

>3. If i downloaded it in an .iso file, do I need to extract it and make a bootable disk? What i'm trying to say is if I can install Ubuntu like
> you would with like Windows 9* or XP??? Or Can i just boot from the .iso file?
Burn the .iso file as you got it, and it should be bootable.

Infarction 503 Posting Virtuoso

Have you ever considered that this isn't the MEPIS installation forum? I realize that there's not so much talk in this particular forum, but we're not desperate for material either...

Infarction 503 Posting Virtuoso

1. It does affect algorithm runtime in several cases, especially when dealing with non-comparison based sorts (since it's proven that comparision based sorts cannot be guaranteed to run in better than O(n log n) time, they don't make the cut for this problem). Look at some of the sorts already mentioned in this thread.

2. Linear time with respect to the length of the input.

Infarction 503 Posting Virtuoso

So your problem now is...?

Infarction 503 Posting Virtuoso

Excel uses a proprietary format. Unless you know how to decode it, you won't be able to get very far. You might try exporting the excel file as a CSV or something...

Infarction 503 Posting Virtuoso

haha, thanks. I was just fiddling around because you said nobody'd done it before. I much prefer the printf as well.

Infarction 503 Posting Virtuoso

Wanna bet?

Ongoing challenge no one has solved yet:

Convert this printf() statement into readable C++, output must match exactly:

int iVal = 2;
int hVal= 0x0C;
char *filename = "test.fil";
char *username = "juser";
float fValue = 23.8;
printf("%4d  0x%02X  Testfile: [%10s]  user: [%-10s]\nTrial %8.2f \n", 
        iVal, hVal, filename, username, fValue);

Output

2  0x0C  Testfile: [  test.fil]  user: [juser     ]
Trial    23.80

While I think my code is readable, that certainly doesn't mean it's the best solution to the problem :p
Code:

#include <iostream>
#include <iomanip>
#include <cstdio>
using namespace std;

int main()
{
  int iVal = 2;
  int hVal= 0x0C;
  char *filename = "test.fil";
  char *username = "juser";
  float fValue = 23.8;
  printf("%4d  0x%02X  Testfile: [%10s]  user: [%-10s]\nTrial %8.2f \n",
      iVal, hVal, filename, username, fValue);

  cout << setw(4) << iVal;
  cout << "  0x" << hex << uppercase << setprecision(2) << setfill('0') << setw(2) << hVal;
  cout << setfill(' ') << dec; // reset things
  cout << "  Testfile: [" << setw(10) << filename << "]";
  cout << "  user: [" << setw(10) << left << username << right << "]";
  cout << "\n";
  cout << "Trial " << setw(8) << fixed << setprecision(2) << fValue;
  cout << endl;

  return 0;
}

Output:

$ g++ blah.cpp && ./a.out 
   2  0x0C  Testfile: [  test.fil]  user: [juser     ]
Trial    23.80 
   2  0x0C  Testfile: [  test.fil]  user: [juser     ]
Trial    23.80
John A commented: Nice solution :) -joeprogrammer +9
Infarction 503 Posting Virtuoso

What you have to do is for each item in words, you need to see if the pattern can be found in puzzle. It's not just a matter of checking if words and puzzle are equal. You need to see if the characters in a given word occur in horizontal or vertical order in puzzle. This is going to use nested loops. Here's a general idea of one way to do it for finding one word in a grid (very general pseudo-code):

for each letter in the grid (this would probably be a nested loop)
{
  if it's the beginning of the word
  {
    see if it matches horizontally left or right (this'll need a loop)
      if it matches, return the results
    if not, try to match vertically up or down (this'll need a loop)
      if it matches, return the results
  }
}
if it wasn't found, then the word was not in the grid

Then you could do this for each word.

Infarction 503 Posting Virtuoso

AFAIK, apt will leave packages there too. Not positive, but almost certain.

I also recommend you look into emerge --depclean. Does what you're looking for (but not recursively I don't think... I wonder if that's being developed...).

Infarction 503 Posting Virtuoso

sorry guys I stuck again... may be we think wrong.. is that neccesary to think 2d array because we have puzzle[] and word[] we dont have puzzle [] [] ....
and another point is ok we can find z .I mean just one letter... but how we can extract for example "ercan" second letter (r) or we say we find it then third one? how we can say in code in 'words' array's first element 4. letter???
or am I completly wrong way :( :(

We have char* puzzle[]. Think about how pointers and arrays are related (hint: you can index a pointer like you can an array). So we can treat puzzle as though it were char puzzle[][].

For finding a word match, you'll have to do similarly. The list of words is char* words[] but you can think of it as char words[wordIndex][letterIndex], if that helps. So the 'r' in ercan would be words[0][1], and the 'z' in oguz would be words[3][3].

Infarction 503 Posting Virtuoso

I don't think you even need Top3 (and you're using it uninitialized, which is bad). Top will be updated as you call pop, so you could probably just do:

while(Top)
  pop(Top);
Infarction 503 Posting Virtuoso

Here's how the 2-d indexing works: you've got Array[row][col]. col is the horizontal index, row is the vertical one. So if you want to check for a horizontal match you check from your starting point and add or subtract to col depending on the direction. For a vertical match, it's the same but changing row. Pretty straightforward.

A nested loop is simply a loop inside of another, like this:

for (int i = 0; i < n; i++)
{
  for(int j = 0; j < m; j++)
  {
     // do something in here
  }
}
Infarction 503 Posting Virtuoso

I tried running it and after a few small touchups (no logical changes though) it seems that you're off to a good start. Here's how it went:

$ ./a.out 
this is a line

enil a si siht

As you can see, it's working for single items and print_stack is fine :)

for push_string, you can just use a loop over the char*. Since it's really basic, I'll just show you:

void push_string(POINTER *Top,char *string)
{
  int i = 0;  // for indexing string
  while(string[i]) // while not end of string
  {
    push(Top, string[i]); // push item
    i++; // increment
  }
}

This could also be done pretty easily in a for loop.

Infarction 503 Posting Virtuoso

How would you do it by hand? There's a variety of methods, but here's one you could try to implement:
- search each row for the first letter of the word.
- if the word fits horizontally, see if there's a match (both directions)
- if the word fits vertically, see if there's a match (both directions)

and like iamthwee said, you'll be treating the grid like a two-dimentional array. Try it and see how you do ;)