nmaillet 97 Posting Whiz in Training

It's possible, although I have yet to see one that works well. A quick Google search turned up these:

It wouldn't happen to be .NET by chance? It would be quite simple then, with a tool like ILSpy.

nmaillet 97 Posting Whiz in Training

Same way you normally would (with the new keyword), you would just use num instead of an integer value.

nmaillet 97 Posting Whiz in Training

You should be using the indexer (i) to set the appropriate element of the string array, like so: strArray[i] = str;, but before that, you need to initialize the String array to be able to hold the number of elements you will need to store.

nmaillet 97 Posting Whiz in Training

It is common for applications to prevent the user from interacting with other parts of the application, as Reverend Jim describes; however, I haven't really seen any applications that do this, aside from system processes.

There are quite a few things that can get in the way of this, besides mouse clicks:

  • Changing windows with keyboard shortcuts (Alt+Tab, WinKey+Tab)
  • Task Manager (Ctrl+Alt+Del, Crtl+Shift+Esc)
  • Start Menu (WinKey, Ctrl+Esc)
  • etc.

You may be able to capture and handle all of the mouse clicks on-screen without too much difficulty, but without preventing the keyboard shortcuts (which I don't think would be doable without getting down to driver-level software) I couldn't see much point in it.

Do you have a reason for wanting to do this? Most users like to be able to switch between applications, and is a key purpose for many modern Operating Systems.

nmaillet 97 Posting Whiz in Training

In C++, an unimplemented default constructor does nothing. If you declare and implement the default constructor, you can:

class CheckGarbage
{
private:
    int rollNo;
    float cgpa;
    char* name;
public:
    CheckGarbage()
    {
        rollNo = 0;
        cgpa = 0;
        name = NULL;
    }
    void checkValue()
    {
        cout<<"Roll no : " <<rollNo <<endl;
        cout<<"CGPA : " <<cgpa <<endl;
        cout<<"name : " <<name <<endl;
    }
};

There isn't really an idea of a default value for particular data types in C++, like in some other langauges. What you may be actually referring to, is the default value of a parameter, like so:

CheckGarbage(int r = 0, float c = 0, n = NULL)
{
    rollNo = r;
    cgpa = c;
    name = n;
}

You can read more on them here or here. A constructor with default values for all parameters, takes on the role of the default constructor.

nmaillet 97 Posting Whiz in Training

You can use the Debug class to determine which is empty, like so:

Debug.WriteLine("outter count: " + GetPageAccess.Count);
foreach (CRMDocLib2012Model.GetPageAccess_Result lst in GetPageAccess)
{
    Debug.WriteLine("inner count: " + gvPageAccess.Rows.Count);
    foreach (GridViewRow Item in gvPageAccess.Rows)
    {
        ...
    }
}
nmaillet 97 Posting Whiz in Training

It's for portability. The last paragraph of the link you posted explains it quite well. Given their example (the "I16LP32 processor"), let's assume we want to get the length of a C-string:

unsigned int length;
length = strlen(str);

That's fine until the length of the string is greater than 65536 (however uncommon, still possible). So you might say, let's always use an unsigned long. That's ok in this example, since it matches the pointer size, but it may be wasteful in some case. For instance, if a 16-bit system used long to represent a 32-bit integer.

If I remember correctly, their example is similar to how Windows operates:

  • int and long are 32 bits and long long is 64 bits on a 32-bit system.
  • int is 32 bits and long and long long are 64 bits on a 64-bit system.

They seem to use long as the pointer size, but this isn't part of the standard, so it couldn't be guaranteed across systems and compilers.

Hope that helps.

nmaillet 97 Posting Whiz in Training

You shouldn't use Wikipedia to back up and argument or in research, it can be edited by anyone so it's unreliable.

You seem to have forgotten to post your sources... Your post can be edited by you, so how else am I going to know if it's reliable?

ChrisHunter commented: Touché +4
nmaillet 97 Posting Whiz in Training

Just an FYI in response to darkagn (and anyone else who reads this thread later). According to Wikipedia, the versions of Mono do not follow the C# version (which also doesn't necessarily follow the .NET Framework version).

Mono 3.0 implements C# 5.0 which runs on .NET Framework 4.5.

nmaillet 97 Posting Whiz in Training

You should show some effort in attempting this problem before asking for help. There's a good C++ tutorial at this site: http://www.cplusplus.com/doc/tutorial/.

nmaillet 97 Posting Whiz in Training

When you call send() in your client code, you're using the return value of strlen() as the number of bytes to send. Remember that strlen() does not include the terminating \0 in its count. So you'll have to add 1 to compensate for the terminating character. Make sure you're doing the same in your server code.

nmaillet 97 Posting Whiz in Training

Show some effort or nobody is going to help you here.

nmaillet 97 Posting Whiz in Training

I guess what I'm getting at, is that you stated it as fact (maybe not intended) that they are the best. Reviews are incredibly subjective, because people are subjective and will always have some bias. Here's some user reviews from the second link of a Google search for "godaddy reviews": http://www.whoishostingthis.com/hosting-reviews/go-daddy/. Some people weren't too happy with their hosting, so it would look like GoDaddy is not the best, in their opinion.

Also, read this review again: http://web-hosting-review.toptenreviews.com/godaddy-review.html and use its "Compare" feature. GoDaddy only came in at number 1 in ease of use (tied with 2 others). How could the best have fallen behind others in some areas?

EDIT: In fact, according to that review (that you posted) justhot.com is better: http://web-hosting-review.toptenreviews.com/. It beat or tied GoDaddy in every category.

nmaillet 97 Posting Whiz in Training

best host there is out there.

That's a very bold statement. Do you have anything to back it up?

nmaillet 97 Posting Whiz in Training

A very simple service to use is http://checkip.dyndns.org/. It returns a very basic HTML page that is easy to parse, like (fake IP address):

<html><head><title>Current IP Check</title></head><body>Current IP Address: 127.0.0.1</body></html>

Then you could use the HttpWebRequest and HttpWebResponse classes to get the HTML file.

nmaillet 97 Posting Whiz in Training

It sure is possible, since C/C++ offers no built-in bounds checking. The 11th and 12th elements will refer to the memory location of the array (a) + 10 and + 11 respectively. What is in those memory locations would be difficult to say, and would be implementation specific. You could possibly be reading/writing values from other variables/arrays, unallocated space in the heap, or the OS could terminate the program if it goes beyond the programs allocated memory.

Basically, it's undefined and you shouldn't do it. You can't be sure if the data will be the same when you go to access it, and it could mess up other values or cause the program to terminate.

nmaillet 97 Posting Whiz in Training

Might I recommond a read-through of: User Input Validation in Windows Forms. Also, Google "winforms validation"; you'll find some decent tutorials.

There are a few issues I have with Begginnerdev's suggestion:

  1. Not focusing on the textbox, bypasses the validation (eg. click an OK button before clicking the textbox). There are work-arounds, but aren't very scaleable.
  2. The user gets trapped until they enter a valid value. This is mostly personal preference, and not always a big issue.
  3. Message boxes for every invalid value can be a pain to the user. Again, personal preference, but a consideration.

I could go on, and have been in a few debates over this, but I want to point out that it isn't necessarily bad design. It comes down to personal preference in some sense, but I prefer other solutions that are more scalable and I think the user will be happier with.

Begginnerdev commented: True, but this was only for proof of concept. = ) +7
nmaillet 97 Posting Whiz in Training

MonoDevelop is a free cross-platform IDE for .NET langauges. It can build applications for Mono, which is a cross-platform implementation of the .NET Framework (I believe it can also target .NET, which would support Windows only).

I haven't used it in years, but it seemed pretty good then.

nmaillet 97 Posting Whiz in Training

You're calling Exit Sub in each iteration when the current item isn't a CD-Rom. You can use a boolean variable instead:

Dim failed As Boolean
failed = True
For Each drive In DriveInfo.GetDrives()
    If drive.DriveType = DriveType.CDRom Then
       MessageBox.Show(drive.ToString())
       CD_Targetpath = drive.ToString
       failed = False
    End If
Next
If failed Then
   MessageBox.Show("CD drive does not exist")
   Exit Sub
End If

Now you'll still have to work on what happens when multiple CD-Rom drives exist.

nmaillet 97 Posting Whiz in Training

You can use the double.ToString(string format) to specify the way a double is formatted. See Standard Numeric Format Strings and Custom Numeric Format Strings. For example, 1e64 with the "custom" format string 0 returns the string 10000000000000000000000000000000000000000000000000000000000000000. This example doesn't account for decimal digits, but you could use the standard f format specifier, if you have an idea of how many digits you need.

If you're running into issues with decimal digits (eg. 0.000000000000000002929), then you'll want to have a look at this thread.

nmaillet 97 Posting Whiz in Training

I'm using VS2010, so it may be different. But your subsystem is probably set to Windows. So open the project properties (right click on the project in Solution Explorer and click Properties). Then under Configuration Properties -> Linker -> System make sure it's set to Console.

Basically, when Console is defined, it uses the main() function as a starting point. However, when Windows is defined, it expects a WinMain() function (with no attached console; used for GUI applications).

CGSMCMLXXV does make a fair point about keeping the console window open after the result is displayed.

nmaillet 97 Posting Whiz in Training

Using Add Service Reference... in the project's context menu, allows you to add a local WSDL file. Visual Studio can then generate the necessary classes, and you can specifiy the URL to use like so:

new MyServiceClient("config", "remoteAddress");

Where you would replace "config" and "remoteAddress" with the appropriate config and URL respectively (or specify the remote URL in the config).

Unless there's something I'm not getting about your question...

mradzinski006 commented: Correct answer +0
nmaillet 97 Posting Whiz in Training

Glad I could help. Please mark the thread solved unless you had any more questions.

nmaillet 97 Posting Whiz in Training

I don't see anything "missing", I also don't see where an exception would be thrown (other than not having a Main() method defined; which would be a compile-time exception anyways). Could you post the exception you are getting?

Also, your execution order won't work... You're attempting to raise the event before a handler is added. In other words, you are attempting to raise an event in the MyEventHandle constructor, which executes from line 41, but you don't define a handler until line 44.

nmaillet 97 Posting Whiz in Training

You're welcome.

The child nodes of DATA_RECORD are not attributes, they are elements. Attributes look like this:

<DATA_RECORD NGIE_REFNO="318">
    ...
</DATA_RECORD>

whereas elements look like this:

<DATA_RECORD>
    <NGIE_REFNO>318</NGIE_REFNO>
    ...
</DATA_RECORD>

EDIT: Here's a pretty good tutorial on XML: http://w3schools.com/xml/default.asp

nmaillet 97 Posting Whiz in Training

Elements() only retrieves direct child nodes. XDocument will only have child node, the root node (main in this case).

You would have to use the XDocument.Root property to access the root node (you should not be loading that from the file as well; get rid of line 2 of your first code snippet). Then use Elements() on it, like so:

doc.Root.Elements("DATA_RECORD");

FYI, there is also a Descendants() method that would work on the document, as it searches all child nodes (ie. child node, children of child node, etc.).

nmaillet 97 Posting Whiz in Training

One option is to let the database (assuming you use one) handle the ID generation. Basically, you let the user enter all of the information, then let the database assign an ID when it is inserted into the table. This can be utilized by many database engines with a simple keyword when creating or altering a table (i.e. IDENTITY for SQL Server, AUTO INCREMENT for MySQL, etc.). Modern database engines can generally handle concurrent database access quite well. See here for more info.

nmaillet 97 Posting Whiz in Training

I don't think you'd learn very much if I did.

Start with the constructor and use the in and binary flags. Then, create a character array (buffer) and use the read() method to fill the buffer. You could either set the buffer to the same size as gridMap (ie. 5225 = 95*55) and call read() once or a smaller value, like the row length, and call read() whenever you need. Then call close() when you're done.

FYI, your for-loop wouldn't iterate through each element. It would move diagonally through the grid like this:

  1. i = 0, j = 0
  2. i = 1, j = 1
  3. i = 2, j = 2
  4. etc.

You should use two for-loops like so:

for(int i = 0; i < 95; i++)
{
    for(int j = 0; j < 55; j++)
    {

    }
}
nmaillet 97 Posting Whiz in Training

Try this, and post if you have any issues.

nmaillet 97 Posting Whiz in Training
nmaillet 97 Posting Whiz in Training

If you're cursious, the implementation for that StringBuilder constructor is (in Microsoft's .NET 4.0 implementation):

public StringBuilder(string value) : this(value, 16)
{
}

Which basically means, that if you don't specify a capacity it will be 16 or the length of the string, whichever is greater (I should also note that you should never rely on that always being true, as it could be implemented differently elsewhere).

And just to clarify, you should use the Capacity property if you just want to check the capacity. EnsureCapacity() should be used when you are going to be appending/inserting characters multiple times, and have an idea about how much total capacity you will need.

nmaillet 97 Posting Whiz in Training

Are you able to run it on your local computer, and do you have the 64-bit runtime package installed on the deployed computer? If not, the MSIs should be located at: C:\Program Files\Microsoft SDKs\Windows\v6.0A\Bootstrapper\Packages\CrystalReports10_5\CRRedist2008_x64.msi

nmaillet 97 Posting Whiz in Training

Could you post all relevant XAML/C# code?

nmaillet 97 Posting Whiz in Training

Lost with what? Have you written any code yet?

nmaillet 97 Posting Whiz in Training

caKus is on the right track, although not a complete enough answer.

First, let me try and explain what can go wrong with your code. Let's assume AnyWorkerIsInCriticalCode is false. So a1_DoWork() skips the while-loop. If a2_DoWork() checks the while-loop condition before a1_DoWork() sets the variable to true, it will skip the while-loop as well. There's another issue with this as well, the compiler may optimize the code to store the boolean variable in a register and skip checking the system RAM each time (note that the volatile keyword could help with this issue, but does not fix the first issue).

So, like caKus said, you can use the Monitor class. What he should have mentioned is that it should be wrapped in a try-finally block, like so:

public class MyClass
{
    private readonly object _lock = new object();

    private void a1_DoWork(object sender, DoWorkEventArgs e)
    {
        Monitor.Enter(_lock);
        try
        {
            //Critical code here.
        }
        finally
        {
            Monitor.Exit(_lock);
        }
    }

    private void a2_DoWork(object sender, DoWorkEventArgs e)
    {
        Monitor.Enter(_lock);
        try
        {
            //Critical code here.
        }
        finally
        {
            Monitor.Exit(_lock);
        }
    }
}

This is a verbose option, which can be simplified by the lock statement like so:

public class MyClass
{
    private readonly object _lock = new object();

    private void a1_DoWork(object sender, DoWorkEventArgs e)
    {
        lock(_lock)
        {
            //Critical code here.
        }
    }

    private void a2_DoWork(object sender, DoWorkEventArgs e)
    {
        lock(_lock)
        {
            //Critical code here.
        }
    }
}

Keep in mind that the variable you lock on should be private (or …

nmaillet 97 Posting Whiz in Training

Wouldn't really make a difference. Are you sharing the instance of the "server" with other threads? If you aren't I'd keep it local to the BackgroundWorker DoWork event handler. If you are, just make sure it's thread safe.

nmaillet 97 Posting Whiz in Training

It's not a stupid question; asking questions is a great way to learn. A BackgroundWorker creates and manages a Thread for you, and provides a few convenient features. So I'll try and give a quick explanation of how a BackgroundWorker works.

First the BackgoundWorker creates a Thread and executes the DoWork event. So everything you do in the DoWork event handler, is executed on a separate thread from the UI thread. From this Thread, you cannot access or interact with any UI components (i.e. you can't update TextBox's, ProgressBar's, etc.). One of the great features of the BackgroundWorker is the ReportProgress() method and the ProgressChanged event. You can call the ReportProgress() method like so:

private void bw_DoWork(object sender, DoWorkEventArgs args)
{
    BackgroundWorker bw = sender as BackgroundWorker;
    ...
    bw.ReportProgress(1);
    ...
}

This causes the "DoWork" thread to block (not execute) while the ProgressChanged event is executed. The event handler for this event is called on the UI thread, so it allows you to update a UI component (such as a ProgressBar). Note that ReportProgres() can also support an Object so you can pass a lot of information to the event handler. Finally, the RunWorkerCompleted event handler is called on the UI thread (when DoWork is done) allowing you to update the UI when it completes.

Hope that helps. Let me know if you have any more questions/need clarification.

nmaillet 97 Posting Whiz in Training

Are you talking about a graphics.h header? As far as I know, most people have stopped using these in favour of some more advanced/modern OS libraries. Take a look at this.

As for making it bootable, I would get a Linux distro and modify it to boot your program.

nmaillet 97 Posting Whiz in Training

The order might have something to do with it. Setting the SelectionBackColor applies the color to the currently selected text. So the text you select after it won't be affected.

If that works for you, great. If not though, could you post some more code (ie Is it a handler/called from a handler? Where is RTBSelectBegin and RTBSelectLength being set from?)?

nmaillet 97 Posting Whiz in Training

try this ....
we can do anything with "while" ... which we do with "For"...
for(assignment;testing;indexing)...
try this ....
while((i++=getchar()) !='\n')..... okay

This thread is a year old. I don't think anything more needs to be said about it.

nmaillet 97 Posting Whiz in Training

The order that the processes are "waiting" may cause some issues. Look into deadlocks.

nmaillet 97 Posting Whiz in Training

Not quite, but you're getting there. Keep in mind that if you have a value as the highest, and a new value is higher, the highest will become the second highest (your first if statement in the for-loop). You should also change your second if statement in the for-loop to an else if and remove the scores[i] <= highest expresion. This ensures that, at most, one is executed. One last thing, I don't see why you would need to assign the highest and second highest back to the array.

nmaillet 97 Posting Whiz in Training

Giving explicit directions to completing a project is not something you're going to get on this forum. If you want some help, show some initiative (and some code) and explain where you are having issues. If you don't know the language, then starting Googling for some C# tutotials.

nmaillet 97 Posting Whiz in Training

Not exactly... you'll pretty well need to start that method from scratch. Very generally: you need to keep a record of the highest and second highest, and in each iteration you need to compare the element to the current highest and second highest and adjust appropriately.

nmaillet 97 Posting Whiz in Training

Your getTopTwoScores() method simply picks the array elements 1 and 2 for the highest two scores (which are 76 and 87). You'll need to use a loop to find the highest scores, like you did to get the scores from input.

nmaillet 97 Posting Whiz in Training

Start by picking a sorting algorithm, then implement it. If you have any trouble with the coding, post your code and explain what isn't working how you'd expect.

nmaillet 97 Posting Whiz in Training

It should be 2. Generally. you get the remainder from (for positive number at least):

a % b = a - b * floor(a / b)

So:

2 % 5 = 2 - 5 * floor(2 / 5)
      = 2 - 5 * floor(0)
      = 2

In other words, 2 / 5 = 0, then there is still 2 "remaining" in the dividend.

nmaillet 97 Posting Whiz in Training

Ok, so you start be creating, starting and joining a thread. This is fine, the UI thread will not execute until "Thread1" finishes. However, in "Thread1" you are updating the LogBox with BeginInvoke(). This is of course correct(ish), since you cannot update controls on anything other then the UI thread. Now, BeginInvoke() runs on the UI thread, but does not block "Thread1". This means that "Thread1" will not wait for the LogBox to be updated.

So the question is: when will the UI get updated? Well, the UI thread is blocked until "Thread1" finishes executing. It also cannot be updated while the method in your code snippet is running. The actual invoke would not take place until control is returned to whatever method is managing the UI (this also rules out Invoke() as an option, as this would lead to a deadlock). So, it is guaranteed not to be set before your if statement.

The first and simplest solution is to not use a thread at all. Since you are blocking the UI thread anyways, threads are completely unnecessary here.

The advantage to using a separate thread with a UI, is to allow the UI to be active while some background work is taking place (if you don't, your UI becomes unresponsive and may stop displaying controls). This leads to the second solution, use a BackgroundWorker. You essentially use 3 events to complete some work:

  1. DoWork: in this event all of the work is handled by a second …
nmaillet 97 Posting Whiz in Training

The column you are retrieving from the "users" table is the entire column of your result (not pertaining to a single row). You'll need to use the DataTable.Rows property instead. Then, use the DataRow.Item property to access the appropriate column. FYI, I would think it's better practice to use the column name instead of the column index.

nmaillet 97 Posting Whiz in Training

Well, you haven't assigned anything to lastGuess, which means you're assigning HigherThan and LowerThan to whatever happens to be in the memory location of lastGuess.