deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Not enough information. Please show us how you're defining and populating your string.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I understand that's not your point, but please understand that your question is impossible to answer without inside knowledge. We can only speculate.

What I can do is observe that the question presumes financial support for infant formula is truly needed. That may very well be the case, but it might also be the case that a doctor didn't try to ascertain the underlying issue and simply prescribed formula as a band-aid. In that case, the proper solution is not to assist in purchasing formula, but to assist in medical expenses for fixing the real problem.

My purpose in pointing that out is to reach a logical rationale about why related programs could have been shut down.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

copyGamma(inStock, 0, gamma);

You're passing 0 into numRows and never change that before the loop. Is 0 less than 0? Because that's the first condition for entering the outer loop, which means it will not be executed because the condition fails.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

The way you've indented your code suggests the error. If nextRow++ needs to be inside the inner loop, the loop body must be surrounded with braces:

for (col = 0; col < NUM_FOUR; col++)
{
    matrix[(nextRow)][col] = matrix[(row)][col] * 3;
    nextRow++;
}
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

In that case I'd question why the baby won't latch. Something is wrong if the natural process of nurturing isn't working. Then again, I'm a problem solver and not a doctor. In my experience, doctors have a tendency to treat symptoms without digging deeper to correct the root cause.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I'm curious, what's wrong with breast milk? Completely free, and arguably healthier in the long term.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

What about pictures in posts?

That's fully supported. In the editor tool bar you can add files with the Files button. Image files that are uploaded can be embedded in a post. However, please note that if you put that picture on every post as a way to get around the limitations of the signature feature, it may be flagged as a fake signature and removed as per our rules.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

D'you think you'll be releasing images soon?

It's working by design. We have no plans currently to support images in signatures. Might I suggest using your picture as your avatar? That would produce more or less the same effect.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Close. There's a Rows property that represents a collection. Unfortunately, DataTables are somewhat awkward to work with.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Signatures are text only. Feel free to use the link though.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Congratulations, you picked the worst possible option. But I wish you the best of luck in your future endeavors.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

This in not suitable answer

Because there's not a suitable answer for console mode applications. If you want that kind of control you have three options, ranging from bad to high learning curve:

  1. Take control of the input shell with raw input (incomplete and kludgy)
  2. Use a curses library to turn the console into more of a GUI.
  3. Use an actual GUI library.

You're not going to get the result you want easily, regardless of which approach you take.

but this inswer is not right....

Just because it's not what you wanted to hear doesn't mean it's not right.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

You can pull everything with a single cin call, provided the two items are separated by whitespace during input:

cin >> a >> b;

Adjust your prompts to that and it'll be closer to what you want. However, if you want free form control over the console, you'd be better off moving to a GUI than trying to make the console do something it's not well suited to do.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

So I would assume that by looking at the stream data (in its encoded form) there may or may not be a way of telling what kind of filter to apply to it in order to decode it.

I don't doubt it, but that may be excessively difficult. You're in luck though, as many file formats will have an identifying prefix in the byte stream that you can use. For example:

Zip:     50 4B
Rar:     52 61 72 21
Tar-LZW: 1F 9D
GZip:    1F 8B
DEFLATE: 78 9C
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

This seems like it may be better suited to a server cron job, since I'm assuming it depends on the date of the file's creation relative to the current date. You'd want some schedule task that runs daily.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

How are you creating the database? Libraries such as the Entity Framework can create the database for you, and deployment is trivial given the correct connections and permissions into SQL. If the database was created manually, you need to recreate it manually, provide SQL scripts that recreate it, or include a backup drop that can be restored into the SQL Server at installation time. Automating this is harder though, and it may be better to just include a second step in your wherein a DBA makes sure that everything is set up properly.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

What do you mean by how to identify it? When looking at an encoding algorithm, or the resulting encoded bytes?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Is it because you're guys?!

I'm not sure how that would make a difference.

I'm really lucky if I get a little elliptical workout in every so often, and I'm content with that!

If it's important enough to you, you can make time for it. My workouts are quick, but effective. Since I live 10 minutes from work, the time I'd spend commuting can be factored into the workour also. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

root posseses some junk value..

Just a correction, but since root is a global variable, it's properly initialized to 0 (ie. a null pointer). It doesn't contain a junk value, though line 41 is indeed erroneous; it should be pushing temp rather than root.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Then I'm not sure. You're definitely missing a definition for the sum constructor, but that shouldn't cause a linker error with add.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

How are you building the files together into an executable? The code looks fine, but the errors suggests that main.cpp and definition.cpp aren't linked together.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Do you have any extensions or non-standard toolbars enabled on your browser? I've been test with a relatively clean install of Opera (as it's not my main broser), and usually issues like this are caused by some conflicting extension or running program.

That said, while Dani may not run Daniweb through the gamut of browsers, I do. And I've make sure that all of the big name desktop browsers don't have obvious reproducible issues. ;) However, there are so many variables involved it's difficult to test exhaustively.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I'm unable to reproduce the vaguely stated problem on Opera. Can you provide precise reproduction steps?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I may rewrite a number of my tutorials and close down my site if Daniweb's interface is suitable for...shall we say, somewhat longer tuts with plenty of awesome code? ;) I don't think I've seen any really long ones yet.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Yes, someone can assist. But nobody will do it for you. Please point out what difficulties you're having so that it doesn't sound like you want your homework done for you.

Begginnerdev commented: Sounds like Copy/Paste strikes again! +9
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

It'll compile if you're lucky (probably not though), and you won't get past linking because the underlying library is missing. To make it more obvious what will happen, consider downloading windows.h onto a Linux machine and imagine how far you'd get.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Like when u say "conio.h is not supported", so compiler doesn't support ? How can it be ?

The compiler must implement certain libraries as specified in the ISO standard, these include stdio, stdlib, string, and ctype. Any other libraries are not required, and the compiler vendor can choose not to implement them. The conio library is one such non-standard library, so not all compilers will implement it.

Headers are merely the "public interface" for a library.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

1 - why they want const be uppercase?

It's a naming convention that makes such constants stand out.

2 - why some people adive me use '{' after function\class name and not in next line?

It's just a programming style and makes no difference as long as you're consistent with it. Pick the one you like if you aren't already required to match company or project style guidelines.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

why the 'PRO's' want avoid the "\n"?

It's the opposite. You should avoid endl unless you know that the stream needs to be flushed afterward. Otherwise you should prefer '\n'. endl is implemented like this:

inline ostream& endl(ostream& out)
{
    out.put(out.widen('\n'));
    out.flush();
    return out;
}

There's always an implicit flush involved even if it's not needed.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Please ask a specific question. Simply posting your homework requirements suggests you want someone to do the work for you.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

not just my type of anime I guess.

I think at this point it's safe to say that our preferences are somewhat different, especially when it comes to shoujo. ;)

Since I don't see any of them in your must-watch list, this season definitely won't sweep you off your feet.

I didn't include them since sequels of good series' obviously make the list. I only mentioned the new ones.

I'll keep this thread updated as I keep watching stuff, should be fun to measure up the actual viewing experience against expectations. :)

I was going to wait until more eps came out before giving impressions. Log Horizon looks promising after the first episode though, I'm feeling optimistic.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I don't think it should be required to travel for a week at a time every single month on a permanent basis

The OP doesn't seem to be implying that it's permanent, or that it's been going on for very long at this point.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Can you be more specific about what you can't complete? It's somewhat unreasonable to expect us to review your code and figure out what's missing from a brief description of the requirements.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

You should be able to reference the file with a UNC path.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I'll second Pelles C as a pure C compiler. That said, I don't currently use it because I switch between C and C++ a lot, and a C++ compiler (pretty much all of them are bundled with a C compiler) works better for my needs.

If you ever plan to use C++ as well, something like Visual Studio or Code::Blocks/CodeLite may be better. That way you can be used to the IDE's interface regardless of whether writing code in C or C++.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

How can I convince my boss that having me travel for extending amount of time to visit clients or prospects is not the most productive use of my time.

I'm not entirely sure that's the case, to be honest. At a small company you must wear many hats, simply because there aren't enough resources to for everyone to specialize. Just because you were hired as a developer doesn't mean you won't be asked to perform tasks that are not developing yet still fall within your skillset.

If you feel that you aren't being utilized to the fullest, I'd go talk to your boss about that rather than focusing on not wanting to travel.

I don't see how travel is necessary when there are lots of telecommuting tools available to making communicating over long distances possible.

Remote meetings are a blessing that I'm thankful for on a daily basis because I'm in the unenviable position of handling first tier support on top of my development tasks. That said, they're not ideal for all situations. Even in situations they are good for, clients can still ask you to be onsite because it simply makes them feel better.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Hmmm, i never seemed to like any form of curling weights... they don't anything.

My biceps don't grow well just from compound movements, so I use curls to get better results.

But hey, the huge trick into getting in better shape is your diet and rest (sleep)... that covers 90% of the job ;)

Nutrition is a whole other can of worms. Don't get me started, or I may start talking about biochemistry. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Start from the simplest and work your way up: RLE, sliding window, LZW, and Huffman are the simpler algorithms. They're relatively easy to implement and reason about.

Production level algorithms tend to be either proprietary or variations/combinations of the simpler ones. Also keep in mind that different types of data compress differently and different algorithms will be optimal. For example, RLE variants are simple, but a solid winner in compression quality when you have text or binary that contains long spans of repeated values.

I'd probably browse Amazon for algorithm books and books specializing on compression algorithms and search Google for specific algorithms as a starting point. Wikipedia will give you a list of algorithms to do further reserach on.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

So... what are your favorite workouts?

That's a slippery slope if you ask the right person. My favorite workout is a 4 day upper/lower body split:

Monday: Lower
Tuesday: Upper
Wednesday: Rest
Thursday: Upper
Friday: Lower
Weekend: Rest

The individual exercises vary, but my days are broken down into at least one movement on each plane as the base and additional supplementary exercises as I feel the need or desire:

Upper
  • Vertical pull (eg. Pullup)
  • Horizontal pull (eg. Row)
  • Vertical push (eg. Shoulder press)
  • Horizontal push (eg. Bench press)
Additional Upper
  • Face pulls
  • Biceps curls
  • Triceps presses
  • Pullovers
Lower
  • Push (eg. Squat or leg press)
  • Pull (eg. Deadlift, rack pull, etc...)
  • Calf raises (both seated and standing)
Additional Lower
  • Glute ham raises
  • Leg curls
  • Leg extensions
  • Toe lifts (not sure of the actual name, works the anterior tibialis)

Rep ranges vary depending on the exercise and current progression on weight. I pick a weight that gets me 5 reps where I start to struggle on the last rep, and increase reps until I can do about 10 without struggling, then reset with a higher weight.

With properly tuned reps, my sets naturally fall into the 3-5 range, so I don't usually bother counting them.

I don't do any form of cardio at the gym that doesn't come from lifting weights. However, I do play tennis, which is excellent cardio. :)

I think I remembered everything. Just doing the base …

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Albeit not the most straight forward way :(

Our mark read algorithm was probably one of the most obtuse in the entire code base (excepting the editor parser which neither of us wrote). I don't imagine any solution would be straightforward. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

The solution is the same: you need to save that information somewhere on every read or write. If you don't want to use a separate variable or wrap everything up in a class, then look up the xalloc/iword/pword member functions provided by ios_base.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

To write the file you'll loop through the items and save them to a text file (or a binary file if you so choose). There's a conversion involved to produce the file format you want.

To read the file you'll parse it, convert each record back to something that can be applied to a ListView item, apply it, and repeat for each record until the file is exhausted.

I get the impression that you think there will be a one line solution that magically converts a file to a ListView, which itself would require a bit of scaffolding that you'd have to write as well, if you want it.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

You can use whatever format you want.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Yes, of course there's a way to do that. It's pretty straightforward in that you open the file and then read or write the data. However, it does depend somewhat on the format you want for the file.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Do you want the open mode that was passed to the constructor or open member function? Or do you want to know dynamically whether the last operation was a read or a write?

Ultimately, you'd need to maintain a flag providing this information, which could be stored in the fstream object using xalloc/iword/pword, if you so choose. Though a separate variable would be simpler, in my opinion. Just wrap it up in another class and call it good. For example to remember the open mode:

#include <fstream>
#include <ios>
#include <iostream>
#include <string>

using namespace std;

class File {
    ios::open_mode _mode;
    fstream _stream;
public:
    File(const string& filename, ios::openmode mode)
        : _mode(mode), _stream(filename.c_str(), mode)
    {}

    ios::openmode mode() const
    {
        return _mode;
    }

    fstream& get() {
        return _stream;
    }

    operator fstream&()
    {
        return get(); 
    }
};

int main()
{
    File fs("test.txt", ios::in);
    string s;

    while (getline(fs.get(), s)) {
        cout << s << '\n';
    }

    cout << "Opened in read mode: " << (fs.mode() & ios::in ? "YES" : "NO") << '\n';
    cout << "Opened in write mode: " << (fs.mode() & ios::out ? "YES" : "NO") << '\n';
}

Remembering the last operation is a little more tedious because it needs to be updated every time you perform a read or a write, but it's no more difficult.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I got my list from elsewhere but these are my fall likelies:

  • Strike the Blood
  • Yowamushi Pedal
  • Super Seisyun Brothers
  • Log Horizon
  • Meganebu?
  • Diabolik Lovers
  • Yuusha ni Narenakatta

Log Horizon (SAO knock-off or SAO done right? Let's bet...)

Total knock-off, and everyone knows it. They're trying to cash in on a good prospect, so I don't blame them. But it still may be good, and I enjoy these full dive MMORPG plots.

Do you still think that this season leaves much to be desired?

Unless we get really lucky there don't seem to be any heavy hitters this season among the new stuff. That said, I doubt it'll be a total bomb given some promising second seasons and reboots.

But coming off of last season with Genshiken Nidaime (awesome), Watamote (awesome), and the surprisingly excellent Servant x Service, I suspect fall will seem less than stellar given no absolute must sees.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

See this wiki article about 4-bit computers

I didn't dispute that they exist. They're simply not conducive for a conforming C implementation without some trickiness on the part of the compiler writer. The C standard is very clear about minimum range limits.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I'm guessing you're typing something like "C8" and expecting sound to magically determine that the string corresponds to 4186, which is unreasonable. You need to match the string with the frequency. Here's one option:

struct note { const char *name; int frequency; };
struct note notes[] = {
    {"C2",  65},
    {"Cs2", 69},
    {"D2",  73},
    {"Ds2", 77},
    {"E2",  82},
    /* ... */
    {NULL,   0}
};

/* ... */

for (i = 0; notes[i].name != NULL; i++) {
    if (strcmp(notes[i].name, notein) == 0) {
        sound(notes[i].frequency);
        delay(50);
        nosound();
    }
}

Also keep in mind that sound takes an integer argument, so you can't pass a string and have it do anything meaningful. In fact, I'm surprised it compiles as you have it.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Please post your code.