deceptikon 1,790 Code Sniper Team Colleague Featured Poster

What is this and why do you want it decoded? Against my better judgment I'm giving you the benefit of the doubt rather than closing this thread given your posts thus far.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

When a picture box is empty, the Image property is null. I'd wager that however you're saving the data doesn't take into account that the image might be a null object.

You can either change how you save the data to account for nulls, or ensure that the picture box always has at least a default image.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

The issue is all the programs I'm making at the moment are boring, they don't serve a purpose really so it's just learning that is the problem.

I understand that only too well. When I was learning, the toy programs to test out new ideas and practice felt empty and boring. That's one of the reasons why I developed an interest in compilers and standard libraries. While I literally burned through three copies of K&R due to them falling apart from constant use, my favorite C book is still The Standard C Library and it encouraged me to write a number of my own implementations.

That obsession with tool building kept my interest when learning. More importantly, it gave me a base to become the go-to toolsmith programmer at work. :D These days I work more with C#, but reading the .NET reference source for fun and using dotPeek to decompile whatever I can get my hands on makes me think that I never lost that initial spark of wanting to look under the hood for seemingly innocuous things and figure out how they really work.

You might try finding a similar niche that keeps your drive going but also promotes your programming education.

00Gambit commented: thanks +0
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

You only update the longest word when it's longer than the current word. If you want the last instance of the longest word when there are multiple instances having the same length, update the longest word when it's equal to or longer:

if (strlen(word) >= strlen(max))
{
    strcpy(max, word);
}
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Dave and I go way back, from cprogramming.com circa 2000 to flashdaddy (now entropysink, IIRC), and Daniweb. The banter and sharing of knowledge was top notch every time. :D I think my fondest memories were the many MSN Messenger chats we had about programming and whatever else came to mind.

There are a handful of people from these forums that I consider friends, and Dave remains number 1 on that list.

From a programming perspective, I was always amazed at his bit twiddling skills since that's something I had to think about yet he could bang out anything without breaking a sweat.

On all forums, I honestly don't remember Dave losing patience or failing to help someone thoroughly. Given that he was very active on cprog before coming to Daniweb, and the tradition of heavy snark there, his restraint was very impressive. Compare it with Narue or Salem, who never really gave up the snarky traditions of cprog when posting on Daniweb.

I distinctly remember his passing, as well as how hard it hit me. I think I completely lost interest in Daniweb for a good two or three weeks because of it. That might surprise some people since Dave and I never met face to face, but it's a testament to how real online friendships can be.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

The bad news is that if you're not digging it this early, hardcore programming probably isn't for you. Casual programming can remain fun, of course, but any push into serious development or even a career doesn't strike me as promising.

The good news is that it can be easy to get burned out, especially if you're pushing hard to learn and don't really have a solid goal. My suggestion would be to take some time off and do other things[1]. When you feel the itch and return to programming, give it a go and if you lose interest again quickly, put some thought into whether you really want to be a programmer.

That's probably not the answer you wanted, but in my experience, good programmers love it to death. You have to to keep up with constant changes, constant learning, and being slapped in the face with errors and bugs at every turn. Real coding isn't pretty, and it takes a certain type of personality to tolerate it for any measure of time.

[1] Maybe a game that's popular with techies and programmers like go.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Should I be ashamed of myself

Certainly not. I spent a number of years on cprogramming.com before moving to Daniweb. The choice was obvious: cprog had a lot of experts at the time and Daniweb did not, I could offer more by switching. Do what's best for you, my friend. If you find StackOverflow more rewarding, then rest assured your contributions to Daniweb thus far will be appreciated far into the future.

castajiz_2 commented: tnx for the support +0
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

How about a retroactive featuring of Dave Sinkula, sort of as a memorial to a good friend and a great member? Obviously there can't be an interview, but I think it would be a nice gesture.

~s.o.s~ commented: That's a good idea +0
ddanbe commented: Yes, great! And take AD second. +0
iamthwee commented: +1 +0
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

To answer your immediate question, printf(" %d",ocean[ROWS][COLS]); should be printf(" %d",ocean[r][c]);. The former is flat out wrong in that officially oceanOne[10][10] does not exist. In practice it does for your compiler, but only because that's the memory location for oceanTwo[0][0]. That's why the first call gives you random numbers while the second call gives you zeroes. However, if you populate the two arrays with other values, the real problem will be more apparent: both calls to printOcean display the wrong thing.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Also watch out @deceptikon, there is already a ForEach method on List<T>

Yup, and only List<>, which is why the extension method is beneficial. ;)

I don't know what the interaction would be here.

In method overload resolution, more specific ownership takes precedence. So any locally defined method throughout the inheritance hierarchy will be preferred over an extension method. In this case, when both List<> and the IEnumerable<> extension method are in scope, List<>.ForEach will always be selected for a List<> object.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Hmm, I'm not sure I see the benefit in this case. Though variations on ForEach are relatively common. As an example, I have an extension method for ForEach over an IEnumerable<> and another that reports progress over iteration:

/// <summary>
/// Performs an action on each item in an enumerable collection.
/// </summary>
/// <typeparam name="T">The type of items in the collection.</typeparam>
/// <param name="action">The action to perform.</param>
public static void ForEach<T>(this IEnumerable<T> items, Action<T> action)
{
    foreach (var item in items)
    {
        action(item);
    }
}

/// <summary>
/// Performs an action on each item in an enumerable collection with a progress indicator.
/// </summary>
/// <typeparam name="T">The type of items in the collection.</typeparam>
/// <param name="action">The action to perform.</param>
/// <param name="startPercent">Starting progress percentage.</param>
/// <param name="finishPercent">Progress percentage after all items have been traversed.</param>
/// <remarks>
/// The progress percentage is passed to the action for use by the caller.
/// </remarks>
public static void ForEach<T>(this IEnumerable<T> items, Action<T, double> action, double startPercent = 0, double finishPercent = 100)
{
    double progress = startPercent;
    double progressRange = finishPercent - startPercent;
    double progressDelta = progressRange / items.Count();

    foreach (var item in items)
    {
        action(item, progress);
        progress += progressDelta;
    }
}

Replacing a for loop though? I can see it to a certain extent if you want to encourage a more functional style of coding, but use of for should be relatively rare these days anyway. Further, Linq already has Enumerable.Range which somewhat intersects with your extension method's purpose.

ddanbe commented: Thanks for sharing. +15
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

...

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

As soon as i put 7 on im lagging all over the place!!!

XP also had significantly smaller hardware requirements for responsiveness. Example, you could get away with 512MB of RAM on an XP box easily, but on a 7 box it won't be usable.

Tcll commented: I got XP running on 256MB (now 384MB) :) +4
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

It's basically telling you CustomerTBLs does not exist under the dbo schema. My first step would be to carefully check spelling.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

It pains me to recommend WiX, given that the learning curve is so high. However, if you want a free option that's not gimped, I think it's the best one.

pritaeas commented: Nice. +14
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

How much everyone of you has spent on daniweb.com???

I couldn't begin to guess how much time everyone collectively has spent. ;D Since 2005 I'd wager my time spent either participating on or developing Daniweb can be measured in man-years.

In your time period what kind of thing have you learned or discussed here??

Hmm, what have I not discussed? :) Learned is harder as I spend more time helping than being helped, but it would be a lie to say I haven't grown as a programmer from my time on Daniweb.

Is it beneficiary?

Emphatic yes.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I'm not sure I see the benefit of P2P rather than having a controlling server if you're looking at having secured user access (since you mentioned a password). Sure, you could store an identity account locally and transfer the relevant data to peers on connection acceptance, but that's more of a usability feature than any kind of security. It's also relatively easy to spoof.

Can you elaborate on the overall design goals of your chat application?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

To me, the best type of SEO is popularity. The more popular your site is, the higher ranked you would be (based on backlinks, etc).

Indeed. But you're neglecting the critical first step that to become popular you must be noticed. How do you get noticed when your site is a tiny drop in the bucket of the interwebs? That's what SEO accomplishes.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

of course i will read both of papers, and obviuosly i will know the diffrence where it is.

That's not enough to write a program. You need to break down things such that a stupid literal child (aka. a computer) could go through the steps and accomplish the goal.

For example, how would you read both papers? What things would you look at, in what order, how would those things be meaningful for comparing differences? Nothing is obvious to a computer, so even though you would intuitively see a difference, you need to define in exacting detail what a difference looks like with given data and how to interpret it in a systematic way without using any intuition or complex jumping around. This is the purpose of a paper run: to define explicit steps and weed out implicit assumptions.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Would that not lead to more calls to the db which will affect performance?

This question suggests you're either doing more than you've said with the database, or there are a huge number of records. Somehow I don't see an employee table being quite so large that you cannot store the whole thing in memory as a DataTable or whatnot. Further, using a single select query with whatever filter you need or one stored procedure call is about as efficient as you're going to get without involving the DBA to optimize on the database server side.

So...what are we missing in this thread?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

You change your class so that it's possible. As it stands, the interest can only be set from within the class.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Since you're working with raw keyboard data, there's more work to be done than simply calling getch and printing the mask character. You need to recognize a line feed starter as well as any backspacing. Off the top of my head, something like this:

#include <iostream>
#include <cstddef>
#include <conio.h>

using namespace std;

char *read_masked_data(char buf[], size_t n, char mask, bool send_unconditional_newline = true)
{
    int size = 0;
    int ch;

    while ((ch = getch()) != '\r' && size < n - 1)
    {
        if (ch == '\b')
        {
            if (size > 0)
            {
                cout << "\b \b";
                --size;
            }
        }
        else
        {
            cout.put(mask);
            buf[size++] = (char)ch;
        }
    }

    if (ch == '\r' || send_unconditional_newline)
    {
        putch('\n');
    }

    buf[size] = '\0';

    return buf;
}

int main()
{
    char password[4];

    cout << read_masked_data(password, sizeof password, '*') << '\n';
}
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

InterestRate has a private setter, so it's not accessible to callers. AddInterest is a method with no arguments, so the correct call would be:

((DepositAccount)obj[1]).AddInterest();

However, since your interest rate is never modified within the class, you might consider removing the public qualifier on the setter.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

The big question is whether you can get into the industry with a completely new application. If other companies are so far entrenched that it would be very difficult to compete, reselling is a good approach.

However, as a reseller you'd need to bring something special to the table. Usually this means customization services that would be too expensive directly from the vendor or intimacy with the product that rivals the vendor at a noticeably lower cost.

As an example, the company I work for is a hybrid. We primarily resell a few enterprise applications, but also write customizations and custom smaller applications as the need arises. Our unique offering in reselling (as there are many other resellers) is:

  1. Quality, quality, quality. A lot of customers come to us because our solutions are simply better.
  2. Responsive and expert support for our solutions.
  3. Custom coding for the resold software to fully meet business needs.
  4. Completely custom software as needed to round out solutions.

Either way you need to make a name for yourself. Simply reselling and installing out of the box applications won't be super successful. One of our claims to fame is our engineers being able to accomplish things that other resellers deemed impossible. Another is that our support staff themselves are or at one time were engineers, so any support ticket is worked from a high level even at tier 1.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

At this point I'm sure your goal is to stir up shit. Thread closed.

Ahmad Imran commented: Not really but feeling is completely coincidental +0
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I like how you carefully worded the question to make us all look like assholes. Obviously the preference and normal behavior is to help, within reason. Ridiculing one's existence, as you put it, would be against Daniweb rules and such posts should be reported so that moderators can deal with them appropriately.

However, I get the impression that your idea of "ridicule his very existence" is greatly skewed.

Ahmad Imran commented: i did not mean to make you feel like #######s. +0
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

wasnt this site meant for learning

It is. But some effort is expected on your end. Asking easily searchable or vague questions and expecting no snark in return is unreasonable. We're not a replacement for brain function and research.

It was meant as a test.

Yes, and the test was obvious. Many of us have seen such "tests" countless times before, and they have rarely been in good faith. Hence, the responses you've gotten.

Im not trying to make this site into a morals teaching one , It should remain as it is but i want that every ones question be recieved warmly and answered instead of dejecting them and proclaiming how stupid they are

Translation: I'm not trying to change how you do things, I'm just trying to change change how you do things.

I think you'll find that good questions receive good answers while bad questions (ie. lazy, vague, easily answered with STFW or RTFM, having a poor attitude, etc...) are responded to in kind.

As an example, you've started 6 threads. One was an introduction, one was borderline lazy, and the rest were exceptionally lazy. It's no mystery why you haven't been received well.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

It would appear that Ahmad is most adept at copy and paste.

And here I thought he was asking stupid questions because he couldn't use Google. Color me wrong. Turns out we're simply dealing with a troll, which was my second guess.

Ahmad Imran commented: says the person with a troll face herself +0
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Sadly no one could answer this simple question

If you already know the answer such that you know it's simple, why not enlighten us and put the Daniweb geniuses to shame?

Ahmad Imran commented: C++ is an improved version of C created by Bjarne Stroustrup in the 80s, it was originally just C with classes and object orientence +0
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

According to the documentation, it's the index in the source array at which copying begins. Presumably the underlying question is why is that overload being used when the source index is 0?

The reason is that values from the source are being appeneded to the destination rather than copying to the destination starting at index 0, which is default behavior for the simpler overloads. Of the four overloads you have, only two of them offer the option to begin copying to the destination at a different index than 0, and both of them require a starting index for the source.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

And also, out of curiousity, are we allowed to put .gifs up as our avatars?

Provided the GIF is within our size restrictions, you can upload it fine, but if the original is animated the uploaded avatar will not be animated. The reason for this is we do some image processing prior to storage of avatars, and only the first frame of a multi-frame image gets used.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Structure it however you want. It takes time and experimentation to find a project structure that works for you though. As an example, I tend to use something like this:

/codebase
/documentation
/libraries
/media
/output
/tools

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Talk to deceptikon.

Naruto is soooo last decade. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Which is faster and why?

It's difficult to say, but I'd wager the first would be fastest because the compiler is likely to be substantially better at unrolling loops in the most efficient manner. However, there's an implicit assumption that the loop would be unrolled, so as with any performance concerns the first step is to thoroughly profile your options.

What is concept behind this?

Loop unrolling.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Compiler vendors are allowed to add onto the standard C libraries. We sometimes refer to those additions as an extension.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster
e.Handled = true;
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

In your KeyPressEventArgs object is a Handled property. Set that guy before returning from the event handler to disable subsequent control logic on the event.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Daniweb is not a homework service. Please provide evidence that you've attempted a solution on your own, as per our rules.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

cout << thingie is symbolic for "send thingie to cout". cin >> thingie is symbolic for "send something to thingie from cin". The angle brackets denote the direction that data moves.

Whether >> and << are the best symbology for the behavior is up for debate, but it works reasonably well in practice.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

getline isn't a standard function, so your book is correct. The problem is your compiler supports that function as an extension, so the easiest approach would be to change the name of the function in your code to something else.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Assuming you're using the Visual Studio designer, what I do is keep part of the default name and replace the useless number with the same tag as the related control. The tag is chosen based on what the controls do or represent. Often if the controls are bound, the tag would be similar to the property or column I'm binding to. For example:

class Login
{
    public string UserName { get; set; }
}

...

Label labelUserName;
TextBox textBoxUserName

...

textBoxUserName.ResetBinding("Text", _login, "UserName");

This way I can easily find controls in the quick search popup. Typically from the code view I don't care as much about the relation between controls as their actual type, so the type is prefixed.

The full name type is verbose compared to something like a Hungarian convention, but the former is easier to remember (not to mention there are variations of Hungarian that can complicate things). I actually like the verbosity as well, in terms of code readability.

In practice, I haven't typically needed the name of label controls. So while it wouldn't be harmful to leave them with the default numbered name, it just feels unclean to me. And clean code is important. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

You say you need help, but only posted your homework assignment. Please be more specific about what you want help with.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Posting actual code might help instead of paraphrasing lines onesie twosie.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Why doesn't this work in C#?

Because you should be using || in your loop rather than &&. With &&, jaar will only be compared to 1582 if TryParse fails, which is somewhat nonsensical.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

The error is correct. nameLabels is a string (as denoted by your ToString call earlier to convert the cell value), and string is most certainly not a compatible type with string[].

Without more details on what values the "FaceName" cells contain, I can only speculate, but judging by your description of the requirement, I'd approach it like this:

var labels = new string[trainingTable.Rows.Count];

for (int i = 0; i < trainingTable.Rows.Count; i++)
{
    labels[i] = trainingTable.Rows[i]["FaceName"].ToString();
}

Of course, arrays are annoying to work with, and my preference would be a list instead:

var labels = new List<string>();

foreach (DataRow row in trainingTable.Rows)
{
    labels.Add(row["FaceName"].ToString();
}

Or if you favor potentially less performant one-liners:

var labels = trainingTable.AsEnumerable().Select(x => x["FaceName"].ToString()).ToList();

Which can be altered to get an array instead of a list by ending with ToArray rather than ToList.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

The design of how this works is really bad.

It kind of depends on what controls and how the controls can only be operated by the keyboard. But I'll take your word for it. :)

I don't know if I have the ability to 'hook' into it with mouse commands and then stuff the keyboard buffer with keystrokes so the app thinks its getting its normal keys.

Yes, you can do this. It involves some non-trivial P/Invoke stuff to dip into the Win32 API so that you can find the appropriate process and manage focus to send messages. The idea is conceptually similar to a key logger, so I'd start there for research.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

We can't really help unless you ask a specific question.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Hopelessly vague question and mention of a file with no details or examples. Please try again, kthxbye.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

You'd want to execute a long running method in a separate thread to avoid the UI thread becoming unresponsive. Just make sure that there's something for the user to look at or interact with while the method is doing its thing, or it won't matter whether the UI is responsive or not. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Hmm, either my understanding of CLR integration in SQL Server is woefully out of date, or there's a disconnect somewhere. CLR functions are server side entities. You still need vanilla connection strings and T-SQL in your client application.

So your problem boils down to two things as I see it:

  1. Creating a standalone .NET application that doesn't need an installer or any secondary files.

  2. Defining communication with the SQL Server in a way that doesn't need configuration files yet can still be used universally.

The first is simple enough, provided you can safely assume the target .NET framework to be installed. Just make sure your application doesn't need anything that won't be provided by the framework. The second is harder for obvious reasons, and not friendly to changes, but a good start is enabling remote access to the SQL Server and ensuring it's widely available.