deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I don't think that the choice of Padme as the "lucky lady" was inherently bad.

Not inherently, but very poorly executed. ;)

This is slightly off topic but I just went to see transformers today and it pains me how movies these days seems to be all about fitting as many special effects as possible into the film.

Rear Window is one of my favorite movies, and a stellar example of the exact opposite of our current special effects extravaganzas. Special effects are icing on the cake, but a compelling plot and interesting developed characters are the core.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Well, the problem is that they needed to create this very critical romance between Anakin and Padme in order to get Luke and Leia conceived. So, you can't blaim them for putting that one romance in the prequels.

Hmm, they needed to get Luke and Leia conceived, that I'll agree with. But I can blame them for the choice of characters as it didn't have to be Padme. The whole Padme thing seemed poorly thought out to me. It struck me as "well, we have this high profile female character, and this critical male character, and the male character needs to get some for the next three movies to make sense. Let's put them together in a weird way because it would be too much trouble to think of a more realistic progression of events!"

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

1)They didn't too bad... but yes they could explain more like they do in their video games.

Or they could not explain it. That's a huge problem with sci-fi and fantasy these days: authors try to explain phenomena in their world when it's completely unnecessary and often detrimental to the story.

2) I am not into romantic scenes in movies, so I don't really have anything positive about it.

Romance is fine, provided it's done in a way that doesn't break immersion. One thing good authors learn very quickly is that romance is freaking hard to get right.

He would be a good pick when you think about it... only if he played a retired version of him...

The Han Solo from the books is a badass despite not being runny shooty as much anymore. I'd be all for them going that route.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

But OTOH they can't be worse than the prequels.

O ye, of little faith. It could be much worse than the prequels. In terms of suckage, the prequels failed in three big areas:

  1. Trying to explain the force.
  2. Shoehorning a romance in the unlikeliest of places.
  3. Comedy relief character(s) that only pissed us off.

My personal opinion is that Disney could easily acquire rights to any of the book series for Star Wars and have an instant blockbuster storywise. The Thrawn series or X-Wing series come immediately to mind as good choices.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

windows 8 about to die.

Please elaborate.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

http://www.daniweb.com/home/tos
http://www.daniweb.com/community/rules

Each forum may have stickies at the top with specific guidelines for posting within that particular sub-community.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

What I did was to put the nodes into an array, and then use qsort to sort the nodes, and finally to re-construct the linked list with the sorted nodes.

I've done that as well, it works nicely. Other option that works is to keep the list sorted as you construct it in the first place, thus eliminating the need to perform a global sort. A few times I've transferred the list to a balanced binary tree and then back to a list with an inorder traversal as an implicit sort. That was surprisingly effective.

If you want to get deeper into less common data structures, instead of a single linked list you could use a skip list. Those are fun, and in a way the best of both worlds between a tree and a list.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

IRC is an internet protocol. mIRC is a chat application using that protocol.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Just for clarification to respondants, GridView and DataGridView are not synonymous. OP, can you specify whether you're using WinForms, WPF, or ASP.NET such that helpers don't need to make assumptions about your terminology?

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Our teacher said that swapping data of nodes is not an efficient method.

That's an unfair statement by your teacher. Pointer surgery may be less efficient depending on the type of data stored by each node. Typically in a well designed list the data is itself a single pointer, which means swapping data is more efficient. If you're directly storing a complex structure then pointer surgery is likely more efficient, but I'd argue that the difference is largely negligible.

In my experience, if you're trying to squeeze out CPU cycles, the list will nearly always be simple enough such that swapping data is the better choice.

That said, there are two ways to go about a pointer swap. If you're working with a single linked list then you must start at the previous pointer to the one being swapped, otherwise the structure of the list will be broken:

a = p->next;
b = p->next->next;

a->next = b->next;
b->next = a;
p->next = b;

If you're working with a double linked list, you can start at the first node to swap, but also must update the previous links:

gp = p->prev;
a = p;
b = p->next;

a->next = b->next;
b->next = a;
gp->next = b;

a->prev = b;
b->prev = gp;

Note that this logic does not take into account edge cases such as where gp or b are NULL. You'll need to add conditional statements to account for such situations.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Hey C is not used so much now a days. But it is a mother language.

It's probably used more than you think. ;) Also, C is closer to the middle of the programming language family tree. When speaking of languages in that subtree, the primary parent is ALGOL. Though it's not unreasonable to call C a parent as it's probably the most pervasive parent.

http://www.digibarn.com/collections/posters/tongues/tongues.jpg

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

If you don't need to run your program on XP, you can use:

Allow me to show you a way to avoid OS dependencies through a standard enumeration: Click Me

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

printf("%c occurs %d times in the entered string.\n",c+'a',count[c]);
what is its cout statement

cout << (c + 'a') << " occurs " << count[c] << " times in the entered string.\n";
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

The same way you'd write a file anywhere else. However, the Program Files folder is protected and may not be accessible depending on the user running the application. Impersonating a user with elevated privileges is kind of hairy, so the better approach would be to store your INI files in the ProgramData folder or isolated storage[1].

[1] Assuming, of course, that your goal for this isn't trying to monkey with the INI file of another program not otherwise under your control. ;)

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

Honestly, I wouldn't worry about it unless you're under some harsh memory constraints.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Why exactly do you need this? Unless you're writing a library (in which case a wrapper is the appropriate solution), it's more a matter of careful coding and checking invariants where necessary.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Impressive texturing.

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'm not hip on the MySQL classes, but you probably want a MySqlDataReader instead, and that object can be initialized with cmd.ExecuteReader(), provided it follows the same design as the standard .NET classes.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

reader is an uninitialized local variable. You need to create an object of DataTableReader and assign the reference to your variable.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Game Grumps on YouTube.

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

All the exprets criticise for using conio.h.

I can't speak for all experts, but I only criticize unnecessary use of conio.h. If it's used with purpose rather than as mindless boilerplate, it's all good. The conio library has useful stuff, after all. I've even included parts of it in my implementation of the standard C library because it's useful.

i want to know how conio.h was helpful and why did they discontinue conio.h.

Once again, if the compiler supports the library, it's safe to use. The problem is that not all compilers support it, which means code that uses it is inherently non-portable. Is that a problem? Not necessarily, but portable code should be favored where practical.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Sounds like a high traffic situation to me, either from your end or ours. Daniweb is a rather script-heavy site, which means it's more sensitive to any kind of connection slowness than sites which are more static.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

but, THIS IS PRINTING "BITMAP"

The principle is the same. You're printing an image, so the image must be drawn. The difference in your case is that you'd be drawing the text inside the grid rather than a screen cap of the grid itself. This requires looping through your rows and cells, then drawing the text on your document for printing.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Furthermore it's old and unsupported,

Where available it's supported, the problem is that it's not always available due to not being standard.

People stopped using it 20 years ago

Clearly that's not the case given how often we see it used. ;)

You can also use the standard getchar function if you must.

Which unfortunately is an incomplete solution. This goes into great detail about the issues involved, from a C++-centric perspective. In C, you're SOL without dropping to a non-standard solution (ie. non-blocking I/O).

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

What is an interface in C#?

Click Me.
And me too.

How does IList differ from List?

List is an implementation of IList.

Where do we use an interface?

That's a harder question. The most basic answer is that you use an interface when you want to support potentially many implementations of functionality that support the same methods, properties, indexers, and events. IEnumerable is a good example in that you can return a number of collections as IEnumerable and the caller doesn't need to know or care what the actual collection is as long as they follow the interface provided by IEnumerable.

When do we use an interface in our code?

That's more of a style question. You'll see recommendations across the board from avoiding interfaces because they complicate the design to using interfaces wherever possible to enable scalability and flexibility on the back-end should you choose to change implementations without changing how callers use a class.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

For smaller projects I place enums in a project-level Enumerations.cs file. For larger projects I tend to break things down into folders where each folder holds related stuff and might have its own Enumerations.cs file.

For tiny projects or strongly self-contained classes where only the class needs access to it, I might place the enum in the same file as the class.

The important thing to do is make sure that the structure of your files makes it clear how much visibility an enum has. Putting it in the same file as the class that uses it the most strikes me as a confusing file structure.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I was actually wondering how difficult it would be to produce your own algorithm

Very difficult. The big name algorithms were developed either by world renown mathematicians and/or governments, and even then you see significant flaws discovered that completely invalidate them in relatively short order.

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

It really depends on what kind of code you'll be working with. If you're only doing system level stuff, learning UI components isn't as important. If you're only doing the front end of applications, learning the niggling low level features isn't as important. Repeat ad infinitum for whatever feature you can find. That said, a well rounded programmer tends to be a better programmer in general.

Some aspects of a language like control structures and declarations are fairly universal, but you can get comfortable with those common aspects in a day or less.

So the first question to ask as concerns what the important features to learn are in a programming language is: how am I going to use this language?

Becoming a good programmer is an easier question. Practice makes perfect. Read/understand lots of code, write lots of code, try different things as often as practical, and associate with good programmers whom you can learn from.

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

Your PictureBox stores an Image object, which is not directly compatible with a SQL Server image column. What you need to do is convert the Image object to an array of bytes for storage:

Using ms As New MemoryStream()
    PictureBox1.Save(ms, ImageFormat.Jpeg)

    Dim data As byte() = ms.ToArray()

    ' Save data to your picture column
End Using

Loading the image back from a database follows a similar pattern:

Dim data As byte()

' Retrieve your picture column into data

Using ms As New MemoryStream(data)
    PictureBox1.Image = Image.FromStream(ms)
End Using
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Is it possible to create an encryption algorith using C#?

Just to be clear, are you taking about implementing an existing algorithm in C# or inventing a whole new one? Because the latter is strongly not recommended.

Not that there's anything wrong with studying modern encryption techniques, but be aware that it's a deep hole. The problem is that making up new techniques nearly always results in an incredibly easy to break encryption.

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

Apologies, I assumed you wanted the System.Timers timer. But it looks like you're trying to use the System.Windows.Forms timer:

var MyTimer = new System.Windows.Forms.Timer();

This may be of use to you in chosing which to utilize.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

The .NET framework has three Timer classes. One is in System.Windows.Forms, one is in System.Timers, and one is in System.Threading. When you include more than one namespace with the same class name as a meber, the type must be fully qualified to resolve the ambiguity:

var MyTimer = new 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

OfType is a LINQ extension method. You'd need to add System.Linq to your Imports statements and make sure that the appropriate assemblies are referenced.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Note that ToList is a LINQ extension method, so apply references and usings appropriately.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

Can you acomplish the same thing with arrays for example an array containing both ints and strings?

Yes, actually you can. The reason ArrayList works with multiple types is that it technically holds type object, which is your highest level base class. You can create an array of object (ie. object[] foo;) for the same effect.

However, note that you'll experience the same problem as ArrayList. There's no static type checking, you must take care to cast appropriately on retrieval, and you can suffer the performance hit of boxing/unboxing. The generic List<> was introduced largely to correct those issues.

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

I no longer sport a beard, it put 10 years on me.

I notice that with a beard I get carded less often. There's truth to facial hair adding years to your appearance, as when I'm clean shaven people guess me to be between 10 and 15 years younger. With a beard, they guess closer to 5 years. I suppose I just have a baby face in general. ;p

deceptikon 1,790 Code Sniper Team Colleague Featured Poster

A list can be like List<string, int> myList; it is harder to do that with an array.

That's not a legal declaration. List<> only supports a single generic type. Of course, you can use an aggregate type or any type that holds multiple values. A relatively common thing I do for multiple related types is:

List<KeyValuePair<string, int>> myList;

Or:

List<Tuple<string, int, double>> myList;
deceptikon 1,790 Code Sniper Team Colleague Featured Poster

In C# what is the difference between arrays and lists?

An array has a pre-defined size that cannot change. A list has a dynamic size.

Can we store the same type in a list as an array?

Yes.

Can an list store objects and references to other objects?

Of course. However, there's a caveat. For the generic list, the types must match the declaration.

Where would we use a list instead of an array or vise versa?

As a general practice, I prefer List<> over an array in all cases. That's not to say I don't use arrays, it's just not not my default choice. Typically I only use arrays when I have no choice, such as when an array is the return type of a method I don't control.

What benefits does each have over the other?

This is informative, and should get you started on further research.

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