deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Daniweb is not a homework service. Don't expect anyone to do this for you, or you're sure to miss your deadline.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

You've provided insufficient code to diagnose a problem.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I'm not aware of any. However, if you get stuck on a question you can post it here and we'll help you work through it. That would be vastly more instructive than looking it up in an answer book.

ddanbe commented: Definitely a good tip! +15
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I work with images...a lot. Often this involves image processing of various types such as resizing, resampling, and various cleanup operations. However, a common issue is that people like to conflate Adobe PDF with images. As such, any application that works with images should also work with PDF. However, since PDF isn't in reality an image type (even though it can store images), to do any kind of editing or cleanup a PDF must be converted to an actual image type.

Anyone who has worked with PDF in more than a consumption capacity will know that Adobe products cost money. The most useful enterprise products cost a lot of money. However, there are free options such as Ghostscript if you're willing to learn the SDK. For my personal imaging library I've chosen to create a class that invokes Ghostscript to consume a PDF and produce an image for processing.

The code is straightforward, but because Ghostscript is a C-based SDK, it might be confusing to C# programmers who aren't used to lower level languages or the P/Invoke support in .NET.

The biggest benefit of this class is that it supports streams and byte arrays on top of just the files supported by Ghostscript. One example of using byte arrays is extracting a PDF from an email attachment (which one of my production applications does). Streams are obviously useful without providing examples, of course. ;)

Note 1: For this class to work, gsdll32.dll (available on the Ghostscript site) must …

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Because Microsoft couldn't reach full conformance in time and they created their own priority list of features (which includes C++14 features) based on what they believe customers want most.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

When I run into a problem that seems easy enough that I should be able to solve without much help and I have trouble solving the problem I become disheartened and feel like I shouldnt be programming when fellow programmers are very good with their logic and problem solving skills.

Join the club. :) Problem solving takes practice, and even the best of us have trouble with problems that seem easy and turn out to be troublesome. Don't lose heart, what you're experiencing is completely normal and very common regardless of experience and skill level.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

It was everyone else who started taking me seriously :)

If it makes you feel better, I never take you seriously. :D

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

As a fresher, take what you can get and build a portfolio of experience. The big bucks come later, regardless of what schools tell you. The days of a noob entering the workforce with an enviable salary are long gone.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Apologies if that led you down the road, not intentional.

Careful there Davey, we might start thinking you're a disingeunous journalist who's into fearmongering. ;)

Ernieway...

According to research commissioned by security vendor Bit9 + Carbon Black, nearly half (49%) of the organisations questioned admitted they simply didn't know if their businesses had been compromised or not.

I'd be shocked and amazed if this weren't an optimistic stat. From my experience with clients, it's probably closer to 80% or 90%. And unfortunately, I'm including financial, medical, and government organizations. :(

Actually, I switched which bank I use due to both being clients. The previous one scared the living fashizzles out of me with their IT policies (or lack thereof) and the current is vastly more sensible.

Apparently some 74% of the 250 organisations queried were still running machines on Windows XP despite it having reached end-of-life status and the security implications that brings with it. In fact, only 29% of those still running XP had any plans to replace the OS.

I'd be curious to know which organizations didn't plan to upgrade. In the last three years, pretty much everyone I've worked with still using XP had plans (often on the short list) to upgrade to Windows 7. Likewise, 2000 and 2003 boxes are usually on the short list to go to either 2008 R2 or 2012.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

The WinForms timer only runs in the UI thread. If you want to run in another thread, use another timer. I'd recommend System.Timers.Timer.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

What actual real type could I use instead of var?

The type is Form1, since that's the name of the class, and it derives from System.Windows.Forms.Form:

Form1 instance = new Form1();
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I have a beard, and a damn fine looking one at that. But off the top of my head, I can't think of anyone else I've worked with recently in the IT sphere that had any significant facial hair.

iamthwee commented: +1 for irony +0
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

So if you dont declare protection it is default set to private?

Enumerations and interfaces are public by default when nested in a class. Top level types default to internal. Everything else is private by default.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I love barcodes. In my line of work (image processing and document imaging), barcodes play an integral part in high quality automation. As such, I've developed code from the lowest level of encoding and decoding barcodes up to using a number of libraries for working with barcodes.

The biggest problem with libraries is cost versus functionality. Most of the commercial libraries tend to be expensive and also separate their licenses between 1D and 2D barcodes such that obtaining full functionality is even more expensive. Free barcode libraries rarely support 2D barcodes, which is a deal breaking 9 times out of 10 for me, and when they do the symbology support is weak at best. This is understandable because 2D barcodes typically involve terribly complex encoding and decoding logic, but it's still frustrating to drop thousands of dollars for a commercial library that often includes awkward licensing limitations.

In my endless search for the best library, I found Spire.Barcode. This is a freely available encoding and decoding library that supports both 1D and 2D barcodes. Further, the recognition quality is surprisingly good. That said, there is one huge con:

  • Barcode recognition returns an array of strings.

Why is this a con? Well, there are two questions which are common in barcode recognition that are not directly supported:

  1. What barcode symbology was used to detected the value?
  2. Where is the zone from which the barcode was detected?

As far as I can tell, #2 is impossible with Spire.Barcode as it …

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

If you don't want to use any .NET languages, then ASP.NET won't be useful to you. There's a little bit of a dependency there. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Why can a private variable be accessed by a get and set modifier if its supposed to be private? Isnt a private variable supposed to be protected from modification from outside its class?

A private member is supposed to be protected from uncontrolled modification. A property or method that exposes a private member typically does so in a controlled manner in well designed code.

I suspect in asking the question you're thinking of this:

private int foo;

public int Foo
{
    get { return foo; }
    set { foo = value; }
}

And that's not best practice because it's not much better than making foo public. The most you'll get out of it is future proofing for if you decide to tighten up access to foo (ie. the property is already there and only the set needs modification).

Of course, rather than making the private member public, an autoproperty is the better choice when you don't need controlled public access:

public int Foo { get; set; }

Though I've found more often that I favor this in the general case:

public int Foo { get; private set; }

Wherein Foo is set internally through another component of the public interface like a constructor or method.

Ketsuekiame commented: +1 for the very first line of your post. Not many people understand this +11
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Your problem is known and common. Take a look at this thread for details and resolutions.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

that would be ok if it doesn't have a spam signature?

Not really, but it's far more of a judgment call than obvious signature spam. For a first offense I'd likely leave it be. If posts like that are common, I'd be more inclined to delete flat out due to lack of substance and send a PM (but refrain from issuing infractions unless the PM is ignored). If it's all the member posts, I have no sympathy.

One thing to keep in mind about spammy posts without a signature is that a signature can be added at any time. A not uncommon tactic is to create umpteen borderline spam posts and then add a signature link. So I'm somewhat hesitant about letting borderline spam slide when there's a good possibility for it to become full blown spam.

My general recommendation would be to bring in at least one other mod to help make the call so that we don't end up subjectively deciding what constitutes substance on a whim. It's a fine line, to be sure.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

While I agree in concept, in practice that would be too much to ask of the thread owner. Even the way things are we have problems getting thread owners to mark the thread as solved. Making the process harder by asking them to go through the thread and pick out the most helpful answers would likely result in a marked drop in solved threads. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Looks like the void main stuff has been fixed, but there's no exposition at all. Throwing code at beginners with no explanation won't accomplish much. While it's good to be exposed to examples, the examples must be high quality and carefully explained such that readers understand why they're high quality and why they do what they do.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Every job asked for a Bachelors plus a large handfull of other programming skills I was lacking.

That's normal, unfortunately. HR departments are usually the first gatekeeper and will demand between reasonable and unreasonable credentials. This is where knowing someone on the inside is a good thing.

The reason for my question here is that I've heard it may possibly be a difficult environment for women and older programmers

As always, it depends. I have yet to see any significant difficulties for women in general, provided we're talking about real difficulties rather than petty ones. ;) A larger issue would be older folks. It's unfortunately not uncommon to perceive older people as technological dinosaurs who are set in their ways and refuse to learn new things. You may find yourself having to defend against that mindset in competition for a job with younger people.

as a newbie 50+ woman when graduating will I be a guppy in a pool of sharks LOL?

That's the case as a newbie in general. However, as a 50+ woman, you probably have quite a bit of education and experience in other fields that can be leveraged to give you an advantage over your ~20 year old peers fresh out of high school and college. Exploit that as much as you can. :)

A woman friend of mine works in IT and has found it pretty tough.

IT is a tough field, period. Usually when people ask …

deceptikon 1,790 Code Sniper Team Colleague Featured Poster
  1. 15, for 18 years.
  2. C#, C++, and C, presently.
  3. Of course.
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Overly simplified, but first the language is designed, a grammar is devised, and then a compiler is written in another language.

A common way to test a new language is to write a bootstrapping compiler (ie. a compiler written in the language itself). But the first compiler basically must be written in another language.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

hmm, what's up with the flood of "I wanna be a script kiddie" style posts.

To be fair, script kiddies don't care about how it's done, they just want tools to do it so that they can seem like leet hackers. That's why we call them script kiddies; they run scripts without understanding them. This guy seems to be interested in understanding the details, which is a nice change in the attitude that you usually see.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

This would be to prevent people from trying to legally urge daniweb to remove content that the author wanted to revoke.

Pretty much. The only pressure we tend to receive as concerns deletions is from schools and students. And the answer is always the same: members who post in violation of their school's policy do so at their own risk and their posts will not be removed at either their or their schools behest unless the post breaks one of our rules such that deletion is warranted.

It's probably safer and nicer to ask the author

That's the best approach as a simple courtesy to the author. I'll let Dani chime in with the full licensing stuff, but unofficially it's safe to assume that Daniweb won't seek legal action for using code you find on the forums in proprietary software. On top of being irrationally difficult to enforce, we're simply not that neurotic.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

it protect you and the ones that using your site.

Not really, it just saves us extra work. Daniweb's moderation team is easily the best I've ever seen, and I have no doubt we'd snuff out unsavory types in short order with or without this feature. But with the feature, it gives mods breathing room to participate as regular members instead of always doing moderation work.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I like them both, actually.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

what should i know to develop a library like the C standard library

You should have a strong foundation in C, but not necessarily the uncommon features. As an example, here's a simplified partial implementation of the C library that I wrote. In my estimation, anyone with decent knowledge of C could follow it without too much trouble barring three areas:

  1. The math library uses unions in a way that could be considered advanced.
  2. stdarg.h is very hackish and specific to the target compiler.
  3. The internal components depend on an understanding of the Win32 API.

if im thinking of building my own OS "im just dreaming"

Hardly, but writing an OS is among the most complex projects, if you want it to be more than a toy.

should i create a NEw C for it cause as we know C for linux isnt C for windows ??

C is a standardized language, so C for Linux is exactly the same as C for Windows until you start using platform-specific libraries. That happens quickly since any non-trivial program will likely call into the OS.

if kernel is binary codes how those codes manage other codes "application" o.O ??

The kernel is itself a program. A low level program to be sure, but still just a program. As concerns your question, I'm not sure I understand. Could you clarify what you mean?

and what really happens when i press the …

iamthwee commented: show off +14
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

TextChanged fires every time the text changes, which means you're doing a lot of unnecessary work. Keeping it simple, I'd add a search button that fills in your combo boxes so you have more control over exactly when it happens.

Following that, unless you have strong binding going down, you'll need to populate child combo boxes and explicitly select the correct item.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster
Disclaimer

Full disclosure, this is a problem I've recently encountered at work. I couldn't find a reasonable solution and ended up recommending a logistics approach rather than a full code approach to solve it. The code performs a subset of required functionality to give users more options, but doesn't account for all reported formats. If one of you manages to solve it then I'll likely contact you for permission to use the solution in production code. However, after spending quite a bit of time on this, I'm somewhat confident that it's an unsolvable problem due to ambiguity. Anyone who solves it will earn a lot of l33t points in my mind.

On to the challenge!

Challenge

Users have a text box for date entry, and you have no control over this text box. The string must be converted to a DateTime object so that it's a valid date later in the process. However, users are allowed to type strings that are not parsable by the DateTime class. For example (using 01/01/2014):

  • 1114
  • 112014
  • 01114
  • 0112014
  • 10114
  • 1012014
  • 010114
  • 01012014

There is no consistent range for valid years (noted because one of the cases practically requires verification of the year part).

The challenge is to write an interpreter that will take a valid date with any of the above formats and normalize it into a "MM/dd/yyyy" or "MM/dd/yy" format so that DateTime will parse the string correctly. For strictly ambiguous cases, note the assumption you've made, if any. For the …

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

C# or VB.NET are both freely available. There are free compilers for C++ and Java as well. Those are among the most popular languages.

Mya:) commented: Thanks for fast reply! +2
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

We require proof of effort when helping with homework assignments. Further, don't expect anyone to do the work for you. If you do, you're not going to meet your deadline.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

My preference is to store options in a settings object (application-specific) and then serialize it to an XML file in either the ProgramData folder or isolated storage.

This accomplishes three big things, in my opinion:

  1. The file is located in a place that isn't under tight security (like the app.config file would be).
  2. The file is human readable.
  3. When deserialized, it's easy to bind settings to the user interface.
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Note that cin and cout are objects with a number of input and output methods on varying types. << and >> are overloaded operators for those objects that "simplify" the calling of I/O methods.

See also Nathan's reply, as it's a less pedantic and more practical answer. ;)

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Recent changes to the C and C++ standards allow for variables as array size declarators.

C++ still doesn't support non-const array sizes. C has technically supported it since 1999, but compiler support is currently sparse and promises to remain so. Further, C14 has made VLAs optional even for hosted implementations, so they're basically pointless in portable code across the board given that portable code must account for both support and lack of support. And in lack of support, you're right back to the pointer approach. Which means assuming lack of support results in simpler code.

I don't see any intros to newbies for posting guidelines and such.

Whe have basic and obvious rules, but otherwise anything goes. It's not wrong to reply to older threads, though the community tends to frown upon it unless you add something to the discussion.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Don't use eof() as a loop control because it introduces a fencepost error. eof() returns true only after you try and fail to read from the stream. Instead, the >> operator will return a value that can be used as the condition without any operation ordering issues:

while (openfile >> number)
{
    cout << number << end;
}
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

what's difference b/t polymorphism andinheritance

Polymorphism is an optional feature of inheritance. Your question suggests that you think they're independent, which they're not. Without inheritance (or a significant amount of hackish workarounds), polymorphism doesn't occur.

That's assuming of course that we're talking about polymorphism through virtual member functions rather than polymorphism through templating or overloading. I think that's a safe assumption though, as most people mean polymorphism through inheritance when they say "polymorphism".

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

While swapping if overflow occurs how to manage it....?

Use a temporary variable of the same type, no overflow will occur in that situation. If you try using the arithmetic tricks, overflow is a risk and greatly increases the complexity of the swap for the negligible benefit of a few bytes saved memory. If you try using the XOR swap, swapping with self is a risk and slightly increases the complexity of the swap. XOR also demands that the swapped type be integral.

These tricks put undue restrictions on you, and the savings aren't worth it if you're writing a general purpose swap. So the answer is to just bite the bullet and use a temporary variable; they're not that expensive.

Don't try to be clever, write code that works.

ddanbe commented: Good point! +15
Mayukh_1 commented: That's why using temp variable is always safest..good point +1
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I wouldn't bother qualifying the languages you know as being academic experience. Experience is experience, even if you weren't paid for it. However, I'd refrain from including languages that you don't feel you can comfortably hit the ground running with yet. You're not expected to be a guru, but you would be expected not to ask basic syntax or common library questions.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

What, no comment on the changes? :)

It's jacked up to the point of being useless now. :( The times are all jumbled rather than in order, and it's difficult to tell what's current. Also, the update is too fast to properly investigate what's happening in realtime.

iamthwee commented: Was thinking the same +0
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

As a first language I think c++ could be easier and faster to learn then C#. If you have never learned a programming language before there are lots of concepts that C# assumes you know.

Um...dafuq? How does C++ not have lots of concepts you're assumed to know? Further, no beginner should be expected to already know things, that's the whole point of learning. Regardless of which language one chooses, there will be a learning curve if one is new to programming.

I consider myself to be reasonably proficient with both C++ and C#. In terms of the languages, C# is friendlier and easier to learn. In terms of standard libraries, in general the C# libraries are easier to learn despite being more numerous. But one could argue that learning the .NET framework benefits C++ too if you're using C++/CLI.

If given the choice between only C++ and C# for a beginner to programming, I'd recommend C# as the first language.

Well I just spent 50$ on that book for C#, roughly how long should I spend on C or C++? Also what program should I use for C or C++? I get Visual Studio Pro since I am in school.

Honestly, it doesn't matter what language you start with. Just pick one and run with it. The lessons you'll learn will be valuable, and you can always switch to another language as you get a feel for your preferences and needs.

Since you already have …

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Not if they want a job, a lot of the answers on skillgun are wrong, and the questions are barely in english.

Actually, that's perfect for the majority of interviews. ;) Typically even the "advanced" questions I get are stuff like this:

Them: What does the internal keyword do?
Me: <perfect answer>
Them: Wow, I just learned about that the other day and I've been coding for years.
Me: Seriously?

If you're even remotely proficient with C#, you'll seem like a god.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Your interface methods don't match the implemented methods of the same name. The implementations have three arguments, the interface states that those methods should take no arguments. Therefore, these are unrelated methods to those declared in the interface.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

At the end of the first loop, ptrBr points to a memory location before br[0]. You need to either increment ptrBr or reset it:

#include <stdio.h>

int main(void)
{
    int i, j;
    float ar[5] = {12.75, 18.34, 9.85, 23.78, 16.96}, br[5];
    float *ptrAr, *ptrBr;
    ptrAr = ar;
    ptrBr = &br[4];
    for ( i = 0; i < 5; i++) {
        *ptrBr = *ptrAr;
        ptrAr++;
        ptrBr--;
    }
    ptrBr = br;
    for ( i = 0; i < 5; i++) {
        printf("%5.2f\n", *ptrBr);
        ptrBr++;
    }
    return 0;
}

And if your goal is simply to print the array in reverse, no copying is necessary:

#include <stdio.h>

int main(void)
{
    float ar[5] = {12.75, 18.34, 9.85, 23.78, 16.96};
    float *ptrAr = &ar[4];
    int i;

    for (i = 0; i < 5; i++)
    {
        printf("%5.2f\n", *ptrAr--);
    }

    return 0;
}
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Agreed that homeopathy is largely crap. If you take the stuff that's been proven both through the ages and through science to be effective (honey, garlic, etc...), the collection of "remedies" drops to a fraction and only covers what we'd consider to be minor illnesses and traumas.

Better yet, a number of homeopathic remedies have been shown to have worse side effects and complications than the corresponding pharmeceudicals while also being less effective (if effective at all).

I'm very cautious when someone recommends a "natural" remedy.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

See my original post -- it doesn't likeImports System.Numerics

Imports only opens up the namespace for you so that you don't need a fully qualified name every time. You still need to reference the assemby, otherwise the namespace simply doesn't exist in the project.

And as you can see from my second post .NET 4.5 is installed, which meets the requiremenet of 4.0 or higher.

Installed and targeted are two completely different things. I have 4.5 installed, but if I only target 2.0, I can't use anything in the 4.5 framework. Look at your project properties.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

File operations are inherently slow, relative to in-memory operations. I'd probably go with writing smaller blocks than dumping all of the file contents to a line for a single WriteAllText call. The framework can handle its own buffering for performance and you can limit the amount of string processing you're doing in memory as well as how much memory you're using. A big hit to performance often involves crossing cache lines, which large strings are wont to do.

The absolute fastest you can get would probably force you to drop down to WriteFile using PInvoke, but WriteAllText is one of the fastest options from the framework from benchmarks I've seen.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

how can I quote a respose?

There a question mark button on the editor that will take you to this page describing our Markdown formatting. You can also use any of the other buttons for quick formatting without manually typing it yourself. Just clicking the button will give you a default output, and clicking the button with text already highlighted will format it for you.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I've taught both ways, and high level to low level works better. Going the other way just results in an excessive amount of prerequisites to do anything meaningful, and the student either gets bored or frustrated. Starting higher level while making it clear that there are important things going on under the hood that need to be understood later seems to produce better results.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

maybe @Dani could add a 'Please Mark as Solved' button that users could click to notify the owner of the thread that they should mark it as solved.

The chance of that notification reaching the thread starter doesn't justify adding that feature. As mentioned, the majority of threads are one-off where the one who started it never returns. If you feel a thread should be marked as solved, any moderator can do it. Just flag the first post to let us know.

However, note that to be solved doesn't mean the right answer was given, but that the creator of the thread clearly showed that his or her question was answered. That's one reason why moderators don't mark threads as solved all willy nilly just because we see the right answer in one of the replies.

Further, there's an argument in favor of not cleaning up unsolved threads, despite the feature being available. If the thread is solved, helpful people who have something to add may be less likely to respond. It's a tricky balance between notifying readers that the thread has an accepted answer and encouraging helpers to continue the discussion in a constructive manner.

I don't disagree with your feature suggestion, but I like to play devil's advocate. ;)

Doogledude123 commented: Definitely some good points here. +0