Ketsuekiame 860 Master Poster Featured Poster

Cue everyone telling you to use std::string instead of C-style strings.

Or at least, snprintf ;)

(If you are using the 2011 standards compiler)

manel1989 commented: 5 +0
Ketsuekiame 860 Master Poster Featured Poster

Strictly speaking you should put it in a using statement too :)

Ketsuekiame 860 Master Poster Featured Poster

Honestly, that isn't very much and looks like boiler-plate code.

Logically speaking, how to do your assignment is explained quite well in the assignment question, it even goes so far as to tell you what each method should do.

I think I should re-iterate deceptikon's question, could you please be more specific about what you need assistance with?

rubberman commented: well put. +12
Ketsuekiame 860 Master Poster Featured Poster

Omedeto!

JorgeM commented: Arigatou gozaimasu +0
Ketsuekiame 860 Master Poster Featured Poster

Hiya, I've just tried updating my profile with better information, however it fails to validate my MSN address and Twitter account.

As a note, I hadn't actually updated these values, they were already in the system.

395f67d86f7803faa07f84ddaffdff05

Ketsuekiame 860 Master Poster Featured Poster

I don't know if it's just me, but I find the fact that the rooms re-order their position slightly irritating. The active room always makes itself the first in the list (after the room list). When you select another room, the room you were just in is then pushed to the right one space. This means that the rooms are constantly re-ordering themselves based on when you last visited them.

It's only a heuristics thing, there's nothing wrong with the site, it just means you have to spend more time looking for things when you knew where it was a moment ago.

Seems a bit counter-intuitive to me, based on existing behaviour in other applications. Or am I just being picky? ;)

Additionally, is it possible to make "Community Center Chat" always the top of the room list? Seems to be the general congregation place of members :)

Ketsuekiame 860 Master Poster Featured Poster

You aren't invoking, you're just adding an event handler.

You can call the method directly from the Tick event:

if(this.InvokeRequired)
    this.Invoke(new paintEventHandler(Form1_After1s), new { sender, e });
Ketsuekiame 860 Master Poster Featured Poster

Oh right, you said you were using Visual Basic, I guess you actually meant Visual Studio? :)

Your SQL connection information and data readers should sit in a different class. This will keep your code tidy and re-usable.

I personally don't use the built in DataTables, but read everything in manually (similar to what you've done in SelectedIndexChanged).
What you should do here, is read all the data in to a class structure that you can store somewhere.

You should store your command string separately and you need to add the parameter to your command.

string cmdString = @"select EventName from Event where EventTypeId = @ID order by EventName asc";

You don't need to put your parameters in ' ' marks.

Once you have created your command, you add parameters as such:

using(SqlCommand cmd = new SqlCommand(cmdString, connection))
{
    cmd.Parameters.Add(new SqlParameter("EventName", int.Parse(ID));

    using(SqlDataReader reader = cmd.ExecuteReader())
    {
        while(reader.Read())
        {
            // Populate your class
            // Add populated class to a list somewhere
        }

        reader.Close();
    }
}

If you've not seen/used using before, a basic explanation is that it ensures Dispose is called on your object, preventing memory leaks. using can only be used where the object inherits from IDisposable

Ketsuekiame 860 Master Poster Featured Poster

The combobox is perfectly fine for this kind of task, but you will need to change the style to DropDownList

The event you listed is also the correct place for the code.

A combobox is suitable for anything where you have to select an item of data from a list. The different styles allow different things.
For example; DropDownList will allow you to drop down a selection and that all the items are read-only.
Whereas DropDown will allow you to edit the input section of the ComboBox, allowing you to select an item that isn't already contained.
Simple will display all the items at once and you select a single one. You can also type in the editable portion (at the top where your selection is displayed) and select one of your own choosing.

So in all cases, a combo box is suitable for any situation where you select a single item from a list.

johnrosswrock commented: thanks +0
Ketsuekiame 860 Master Poster Featured Poster

I'm kind of in agreement with the OP here.

Assembly code is hard to read at the best of times and the way it's highlighted by Prettify only makes it worse.
The way the highlighting catches your attention can artificially subset pieces of code and you have to be aware of needing to undo something your brain tends to do automatically. This is especially bad if you've been working recently in more common syntax languages ;)

My personal opinion is of removing all syntax highlighting from Assembly. (Essentially an extension that does nothing)

Ketsuekiame 860 Master Poster Featured Poster

You can connect directly to the Exchange server using a service but you would need to know the user's account details to either A) Impersonate the user at the app level, B) Log the service on as a particular user and use Domain Authentication.

Ketsuekiame 860 Master Poster Featured Poster

The form has a Width and Height property. Change these appropriately.

Ketsuekiame 860 Master Poster Featured Poster

Just thought I'd throw my 2p in.

Be careful with lazy evaluation, you can easily cripple performance by re-iterating queries you already executed.

IEnumerable<int> query = myIntList.Where(i => i > 0);

long result = 0;
// Executes Query
foreach(int i in query)
{
    result += query;
}

// Executes Query again
foreach(int i in query)
{
    result += (query * 2);
}

It's good for things like this though...

IEnumerable<int> queryGreaterThanZero = myIntList.Where(i => i > 0); // Not Executed
IEnumerable<int> queryFilterFive = queryGreaterThanZero.Where(i => i != 5); // Still not executed
IEnumerable<int> queryFinal = queryFilterFive.Where(i => i < 10); // Guess what... ;)

// Executes all queries once only
foreach(int i in queryFinal)
{
    Console.WriteLine(i);
}

// Be careful doing this...

// Executes here
if(queryFinal.Count() > 0)
{
    // Uh oh, executes again
    foreach(int i in queryFinal)
    {
        Console.WriteLine(i);
    }
}

Deceptikon is spot on with the fact that no intermediary objects are created though. That is the single biggest advantage, especially when working with humongous datasets.

ddanbe commented: Thanks for valuable feedback! +14
Ketsuekiame 860 Master Poster Featured Poster

Don't really need to use Regex, String.Replace will work fine :)

string newString = "Deleting 11 files.ABC: Total Time = 01:16:30, Remaining Time = 00:00:00".Replace(' ', ',').Replace('.', ',');

Using regex does look tidier although the one listed above is incorrect. It should be:
string newString = Regex.Replace("Deleting 11 files.ABC: Total Time = 01:16:30, Remaining Time = 00:00:00", @"[\.\s+]", ",");
Note that the full-stop has to be escaped as it is a regex token and 's' is escaped as it indicates a "space", the + sign means "any number of" in this case.

You could also use Aggregate:

string oldString =  "Deleting 11 files.ABC: Total Time = 01:16:30, Remaining Time = 00:00:00";
char[] replace = new char[] { '.', ' ' };
string newString = replace.Aggregate(oldString, (prev, next) => prev.Replace(next, ','));
Ketsuekiame 860 Master Poster Featured Poster

Whoever imposed the 70mph limit needs to be taken out and shot!

;)

On a more serious note, speaking as a Brit, knowing how tightly guns are controlled I feel safer here than I do when I visit the states. I'm still afraid of Mr. Burberry and his chavtastic warriors, but that's a different reason and is part of a whole culture problem here.

People kill people, guns make it easier to kill people and abstract the act of killing away. How easy is it to pull a trigger? Compare that to how easy it is to beat someone to death with a crowbar. I don't mean physically, I mean psychologically.

It is for this reason I despise civilians having guns.

With regards to America, you guys have a different type of police force than we do. Our police force will protect us, as far as I'm aware, yours will not. I refer to a recent case I read: http://www.nypost.com/p/news/local/brooklyn/to_serve_but_not_protect_Qr3ume5gEhMhtg8LvHgzAI?utm_campaign=OutbrainA&utm_source=OutbrainArticlepages&obref=obinsource

Now I understand the reason the judge ruled this way was to protect your gun laws. Are you really happy with that? A law that allows the police to stand there and do nothing while you are assaulted and potentially killed, just so you can have your precious guns? (Which aren't much use in close combat...)
In the UK, if the police see anything like that, they will intervene (as thankfully happened for me) and they have no problems mixing it up in a fight where weapons …

GrimJack commented: Good logical writing - I always like it when Brits enter with some information +0
Ketsuekiame 860 Master Poster Featured Poster

Just because a company is new, it doesn't mean you should avoid them. Evaluate them against what they offer vs the price vs what you can get from other companies.
If it does what you want and is in your budget, buy it using a credit card that offers you fraud protection. At least this way if they try to pull a fast one, you're covered for the purchase you made.

Ketsuekiame 860 Master Poster Featured Poster

Are you moving the files anywhere after they are built. You might have to change the ProcessStartInfo's current working directory so that it can correctly identify the cygwin dll. Or, you could copy the dll file to the directory you're working in. Or, change the current working directory to the same location of the file you are trying to start.

Ketsuekiame 860 Master Poster Featured Poster

C# is a Microsoft specific language and relies on the Microsoft compiler, so your options are very limited.

I believe there are only three different IDEs;
1. Visual Studio (You can use the Express editions for free)
2. SharpDevelop
3. MonoDevelop

If you are dead against using Visual Studio (which I personally think is the best IDE for C# and one of the best in general) then SharpDevelop (also known as #develop) is your best alternative.

You can use MonoDevelop but I wouldn't unless you were building for Linux.

Ketsuekiame 860 Master Poster Featured Poster

You can store the required information anywhere you want really. I use XML Configuration files because it's just a lot easier.

It looks a bit like this:

<OuterTag>
    <Assembly>Namespace.Library.Utility,Version=1.0,Culture=neutral</Assembly>
    <Type>Namespace.Library.Utility.Calculator</Type>
</OuterTag>

You can pass these arguments into the appropriate reflection libraries to load the required assembly.

NOTE: You cannot unload libraries once they are part of your current AppDomain. This means you can't switch between two different versions without reloading the app. It does mean that you can deploy different libraries to different clients though and the application won't care so long as the interfaces are correct. :)

ddanbe commented: Deep knowledge +14
Ketsuekiame 860 Master Poster Featured Poster

Is there any particular reason you want to write it yourself? There are many applications out there that perform the same task.

Morally speaking, as I don't know you, I'd be rather reluctant to help you here. Something like this could be built, deployed and used in a malicious fashion.

If you still want to go ahead (you may have legitimate reasons after all) you might be better checking out the C forum. You will need to at least write a driver to intercept the video output. I believe this is how VNC works.

Ketsuekiame 860 Master Poster Featured Poster

This "FakeWebClient" will allow a C# application to send and receive cookies as part of the request. This behaviour is not available by default.

Please note that on line 35 there is a possible NullReferenceException, I managed this at a level higher but you may wish to handle it in the client.

pritaeas commented: Nice. +14
ddanbe commented: Great. +14
Ketsuekiame 860 Master Poster Featured Poster

Windows Scheduler will probably do what you want, but there are some specific tools to do this. Especially if you want to be clever and perform automatic differential copy and stuff ;)

Otherwise, if you know that the clients will never lose data from a master update, just copy the entire thing from the master.

Ketsuekiame 860 Master Poster Featured Poster

Reduce how many rows you save in a single call and call save repeatedly. Although this won't really change anything, you're still not going to be able to do anything while the rows get saved and this might take longer.

It is impossible to do without threading.

Ketsuekiame 860 Master Poster Featured Poster

The syntax for calling base is public constructor() : base().

It will call the matching base class constructor based on the parameters given to it.

So;
public MyClass() : base() {} will match it up to the constructor that takes no parameters.
public MyClass(String param) : base(param) will match it to the constructor that takes a single string parameter.

The base constructors must be either public or protected.

Ketsuekiame 860 Master Poster Featured Poster

BigPaw, her setup sounds considerably more complicated than just setting the DNS on the router ;)

As she uses a Domain Controller I presume her DNS is set up to cover the internal network in addition to the external network, that requires a little more precise control than a standard router box would offer.

Additionally, on modern operating systems (Windows 7/8), the defrag is performed continuously behind the scenes, most commonly when the machine is idle.
Furthermore, don't ever defrag an SSD:
1. Seek times on an SSD are near-instantaneous due to it being NAND (commonly) flash memory so the position of data is irrelevant.
2. SSDs have a limited number of writes (improved nowadays thanks to wear levelling) so don't perform write operations you don't have to :)

Ketsuekiame 860 Master Poster Featured Poster

You will need a plugin or addon to add this functionality to Visual Studio.

Try Resharper.

As a programmer, you really should be aware of what code can throw an exception already. Most documentation will tell you and (especially in possible NullReference cases) you should be checking for null before hand.

Ketsuekiame 860 Master Poster Featured Poster

Private members aren't XML serialisable, unless you use the DataMember attribute with the name of a public accessor for it.

If you want to serialise private members, use the BinarySerializer and convert to a Base64 string.

Ketsuekiame 860 Master Poster Featured Poster

The PS4 with DDR5 RAM

It's important to distinguish that this is GDDR RAM not plain DDR. Although nowadays they're pretty interchangable, GDDR is built with Graphics chips in mind and will operate better in a graphics context.
Whereas DDR is more adaptable and can qork quickly in a much more generic concept.

I believe the idea behind this is Microsoft's view to being an all in one entertainment system, not a gaming console. Microsoft will more than likely lose some bandwidth due to it being plain DDR, however, until the technical specs are release this is all speculatory.

AFAIK, the XBox runs on a custom built 8-core AMD processor that incorporates a graphics chip. If this is true, the memory controller on-chip may have been built to be just as efficient with DDR3 as the PS4's GDDR5 (I doubt this though).

Having owned a PS3, I'm not going to be looking for a PS4. The PS3 was buggy and the console is slow and laggy. Not even Fifa 12 could run at 60fps (not to mention the controller lag)

So I will be getting the new XBox One.

The ability to run the same code on XBox as your PC is going to be a bit of a game changer in terms of development methinks =)

Ketsuekiame 860 Master Poster Featured Poster

Actually the distance between A & B is irrelevant. If you take note of the question "A car travelled 28Km from A to B in 30 minutes snip What is the speed of the car in kmph" you have all the information you need from the first part of the sentence.

The answer is 56Km/h as answered by Agilemind.

It appears the second part of the question is meant to trick you. This is probably a question to see if you can distinguish important facts from redundant (or misleading) facts. This is often an important aspect in programming.

Ketsuekiame 860 Master Poster Featured Poster

Either is fine, "transportation" is used in more formal writings, but can be a bit of a "mouthful" if you mention it a lot, so I would suggest falling back to "transport".

Ketsuekiame 860 Master Poster Featured Poster

I tend to write articles or code snippets in the software sections that make use of this markup, so I must contest your suggestion to remove it from them.

Ketsuekiame 860 Master Poster Featured Poster

In an effort to reduce [the amount of] documentation, I try as best possible to make all methods perform as little as reasonable.

So if you had a CreateAccount method on a Registration class, the method could be split down into the following logic.

  1. Check if the user exists already
  2. Go to the database and register the details
  3. Send an email to say the account has been created
  4. Return the confirmation of account creation to the user.

A standard developer may just put all that code into the CreateAccount method and leave it at that. However, as you can plainly see, I've been able to split this method into four disparate steps. Each one can be it's own method.

public CreateAccountResult CreateAccount(string username, string emailAddress, string password)
{
    if(!UserIsUnique(username))
    {
        return 
            new CreateAccountResult
            {
                Success = false,
                Message = "This user already exists!"
            };
    }

    if(!DataServices.StoreUserDetails(username, password))
    {
        return
            new CreateAccountResult
            {
                Success = false,
                Message = "Unable to register account. Database failure"
            };
    }

    EmailServices.SendRegistrationEmail(username, emailAddress);

    return
        new CreateAccountResult
        {
            Success = true,
            Message = "Thank you for registering with AwesomeSoftwareInc"
        };
}

Much easier to read and understand what's going on than trying to include all the code that has been separated into those other methods.

Ideally this could be split down further and with proper design it would be incredibly tidy. This is just something off the top of my head in 5 minutes :)

The idea that code should be self-documenting is a good …

Ketsuekiame 860 Master Poster Featured Poster

Unfortunately, there's nothing in the spec about it :(

This Page on the wiki lists a few ways native apps can be supported in the absence of it being included in the specification.

Personally, I think the redirection_uri should be a requirement, as you've done it. The absence of the redirection_uri parameter would normally mean you use the registered redirection_uri for the application. Where a redirection_uri is included it needs to be matched with the registered one, which currently doesn't happen (unless it's client-side authentication). This is all to stop redirection hijack :)

I don't particularly want to get into an argument with you; I'm happy enough with what is available that I can make it work fairly easily. My problem is with OAuth itself, not your implementation of it ;)

Ketsuekiame 860 Master Poster Featured Poster

I would just like to add to this.

OAuth is a great tool to allow website <--> website authentication without having to create handfuls of accounts. I believe this was the original reason it was created. So, as far as being able to log into other websites with Daniweb, that choose to be affiliated with Daniweb, mission accomplished :)

There's an aspect of this process that is assumed: The "man-in-the-middle" is a trusted, neutrally affiliated application. In this case, the browser.

The moment you embed a browser into your application you have broken this trust-chain because it is affiliated with you (the application/developer)

Although the application may be trusted, which we assume so because you're about to give me your username and password, this brings to a null point the reason behind oauth; not giving me your username and password. This is why I don't like OAuth as a mobile developer. The amount of hoops you have to jump through to maintain both a good user experience and the assumed OAuth trust chain, quite frankly, ridiculous.

This brings me on to another point. Whilst I agree that "this is how it's done" nowadays, don't be a lemming :P Just because everyone else embeds the browser and [has the ability to] steal the user credentials doesn't mean we all should.

Finally, and this is more appropriate to Daniweb itself, the OAuth authentication as it's written doesn't follow the correct flow when trying to authenticate natively. Specifically, there is no standard result …

Ketsuekiame 860 Master Poster Featured Poster

When a rights-holder somehow is made aware that his orphaned content is being used or distributed by someone or some company, he can manifest himself, prove that the content is his original work (e.g., "I wrote that song, here is the original recording I took X years ago"), and then stake his claim for royalty back-pay or other form of reparation.

I think this is where the problem will lay for most of us.

Like you said in your example, if you have work, even unpublished work, it can be classified as an orphan if it has no meta-data to identify the owner, or if the owner cannot be verified after a "diligent" search.

So if someone gets ahold of some of your code and uses it themselves, stripping any header/licence content in the process, how do you prove it's yours?
Now think if this gets used in a big company, their lawyers will eat you alive and quite possibly counter-sue for deformation or some other dubious claim.

You effectively lost your rights to the content you wrote and this worries me. The government has legislated to give more protection to companies that use content illegally, to the point of giving them power to claim content they didn't write as their own.

He still has the copyrights, there's no question about that, but the question is whether he can still get some money for that particular project in which his work was used.

Actually I'm …

Ketsuekiame 860 Master Poster Featured Poster

Yes, a lot of people only read the title it seems :P

Ketsuekiame 860 Master Poster Featured Poster

I am not real big into labels anyways, as long as someone makes cool stuff that they are happy with then, rock on!

It becomes an issue when they apply for "Programming" jobs, only list HTML and CSS, then wonder why we accuse them of not being able to fulfill the role...

Now, if they make dynamic content in ASP.NET/PHP or use ample amounts of JavaScript and jQuery I'd tend to be more lenient.

Ketsuekiame 860 Master Poster Featured Poster

You're not a real programmer, you can't program in binary >:(

Such are some elitist people. I would argue that people who create website front-ends (purely HTML) aren't programmers, but scripters instead. That's where my line is drawn ^^

Ketsuekiame 860 Master Poster Featured Poster

I once had to compile the Chromium source code on a Celeron laptop with 512Mb of RAM. Took 14 hours and the build failed, best 3 days off ever ;)

Ketsuekiame 860 Master Poster Featured Poster

I'm inferring from your code that you're using a NotifyIcon with some tooltip text. The limitation actually resides here, as the text for this can be no longer than 63 characters.

It's possible to hack around it using reflection, but if you can get it down to 63 characters that would be much cleaner.

Note: The maximum possible length is 127 characters, even with the hack

Ketsuekiame 860 Master Poster Featured Poster

OAuth is pretty bad for native apps, whilst maintaining the trust of your users. There's ways around it of course, but none of them lead for a good user experience. Unfortunately nothing can be done about that :(

Ketsuekiame 860 Master Poster Featured Poster

Microsoft.Office.Interop.PowerPoint.Presentation preVideo; You declare the variable here but never assign an object to it.

Just use pptPresentation.CreateVideo("movie.wmv"); instead. Should work.

Ketsuekiame 860 Master Poster Featured Poster

This year, I will mostly be learning....POTATOES

(For the non-British, this is a reference to The Fast Show)

Ketsuekiame 860 Master Poster Featured Poster

Oh I see! You forgot to divide by the linear momentum of a comet traversing behind the sun at the perihelion!

Ketsuekiame 860 Master Poster Featured Poster

I'm sure the forum can help you out!

What do you think this is? Ancient Rome?!

Ketsuekiame 860 Master Poster Featured Poster

Did you try reinstalling Windows?

Mike Askew commented: I turned it off and on? +0
Ketsuekiame 860 Master Poster Featured Poster

It took you a year to do that?

Ketsuekiame 860 Master Poster Featured Poster

I decided to push the boat out and actually read the link, just in case this was something complicated.

Delete the registry entry it creates. It's that simple =/ (They even documented that fact)

ddanbe commented: For the reading :) +14
Ketsuekiame 860 Master Poster Featured Poster

For your typical every day user, Windows is by and large the best when it comes to ease of use and available software. That is who the desktop OS is tailored to. General Desktop and Business.

Linux shot itself in the foot by trying to make everything open source and free a philosophy they try to extend to people developing for their OS. This is a pipe-dream. The world runs on money and that isn't going to change (even if currency in a decade is in potatoes, there will always be "money").
Its second failing was giving too much control to the user, even if they didn't want it. Thankfully, SUSe and Ubuntu made headway here, giving you a much more user-friendly desktop-like approach. Unfortunately their reach to the user market (pre-installed variants) is far too shallow and only really made it as far as netbooks which, thankfully, died a swift death.
The third failing is a consequence of the second. Developers want maximum exposure for their software so they can make more money from it. So what do you pick? Windows and Apple Mac of course. Linux variants may surface, but generally later. Another good point here is Steam pushing Linux support. I truly hope this works out.

Unix and variants are far better at anything server related than Mirosoft can throw up. Microsoft are chasing, but are always 5-10 steps behind.

The future? A lot is being pushed onto the Web. We now have Game engines …

Ketsuekiame 860 Master Poster Featured Poster