LizR 171 Posting Virtuoso

The short explaintion of a more efficient version:

When finding prime numbers, you should only test 2 and 3 to the square root of the number in increments of 2 (eg odd numbers), even if you arent going to use a list of generated prime numbers to reduce the time further.

int number;
     Console.Write("Enter a number: ");
     number = int.Parse(Console.ReadLine());
     
     int ctr = 2;
     int sq = (int)Math.Sqrt(number);
     while(ctr < sq)
     {
           if(number % ctr == 0)
                break;
           if (ctr==2) { ctr++; } else {ctr+=2;}
     }
     if(ctr == sq)
         Console.WriteLine("Prime");
     else
         Console.WriteLine("Not Prime as divides by "+ctr.ToString());

     Console.ReadKey();
LizR 171 Posting Virtuoso

Thats a heck of a lot of code.

Work with something smaller, its easier for us, and easier for you as you end up with a small snippet with only whats needed in it

If you just read the files from console, its much harder because someone could write

"..\..\..\..\..\..\..\..\..\dir1\dir2\a.txt"

if you did that using the filepicker of course it would return you a full path to the file.

But, in the example above if your current directory was

c:\dir3\

then the new path would be c:\dir1\dir2\a.txt
but if the current directory was

c:\dir1\dir3

the new path would still be c:\dir1\dir2\a.txt

sounds like you should find a way of parsing the directories

LizR 171 Posting Virtuoso

You're using the wrong event.. Have a look at the others (I know this has been discussed before, I thought even with you)

LizR 171 Posting Virtuoso

UDP stuff is always harder to work with as you cant guarentee its arrival. Have you tried a packet sniffer on the recieving end to ensure its getting there?

LizR 171 Posting Virtuoso

Well, thats a little ambiguous

if you have an array of things

such as

Thing[] mythings = new Thing[100];

you can access their methods just like any other normal variable but by adding the [n] option to say which of the objects you are using

Post a snippet of your code (use code tags), explain where its giving you an error and what, and what you expected..

LizR 171 Posting Virtuoso

for question 1 - surely data binding would be sufficient?
for question 2 - ok? what actual problem are you having with doing this?
for question 3 - its the file open dialog.. While it doesnt "upload" it gives you the name of the file and you can go get it.
for question 4 - you could use windows search if its enabled.

LizR 171 Posting Virtuoso

Have a search for the perfmon calls, they would be your best bet. I dont have the info to hand so you can google just as well as me :)

LizR 171 Posting Virtuoso

So you have some how to run a process code, and send it parameters..
When you have some code to show, come back with any problems - be sure to include the relevant code, and whats happening/not happening.

LizR 171 Posting Virtuoso

regexpressions arent hard, but rather than just stumble about go to http://RegExpStudio.com and play with the studio product, it will help you undertand more.

LizR 171 Posting Virtuoso

As for the "no copy" you will struggle with that as it takes very little to put a proxy in between and log the URLs and download the data - unless you do it in some exceedingly unique and encrypted format.

Use httprequest to download items, (examples available in helpfile)

LizR 171 Posting Virtuoso

um
Thats not a class, thats just a method

You would need to pass the treeview, or return collection of nodes.

LizR 171 Posting Virtuoso

Well it depends a lot on whats in your mytreenodeclass.

Short answer is, pass the URL in the constructor.

LizR 171 Posting Virtuoso

There are ways you could improve it, but its on the right track.

Something you might want to investigate are the "mod" or % maths functionality

LizR 171 Posting Virtuoso

As I said you need to copy out the relevant "frame" from within your big picture. Doing it into an array is often easiest to code with later.

so if your picture was in the format

1 2 3 4
5 6 7 8

(numbers representing your man in a frame)
you use some maths, to extract each of the bitmaps (either by calculating the size of the picture given the original size of the image and the number of "frames" wide and tall, or by specifying them, and then copy that section into a new picture in your array of mini pictures constituting a frame.

Then to play the animation you would use a timer (or similar) to change the image to the next in rotation every interval you pick.

LizR 171 Posting Virtuoso

The free one that comes with visual studio ..

LizR 171 Posting Virtuoso

What Id suggest is look at the value of qry, check it visually for validity, if ok, then run it direct in something like msaccess or sql query builder or such, and see if you get an error, such as some value is a dup, its missing a required field, or whatever

LizR 171 Posting Virtuoso

Do be aware that the dev SQL server has limited connections too.

LizR 171 Posting Virtuoso

Long as you add them as resources you can use them

LizR 171 Posting Virtuoso

It gets really tiring to see people who dont try and then expect others here to do the work. I know theres no date format that does the suffix, which is why I got you to look. If you google there are plenty of functions out there prewritten you can use to do it.

I too know theres no built in function to do it, it seems kind of a large oversight IMHO, but, there isnt. However, like most things like this, someone already has hit this and written something to do it. I got back a lot of hits with sensible code from google.

LizR 171 Posting Virtuoso

So, you didnt bother with the other half of my post then.
You dont seem to be debugging your code, as you dont seem to be able to show me what you found.. only that "heres some code, you look for yourself."

LizR 171 Posting Virtuoso

biggest problem you will have is when summertime kicks in (or daylight savings whatever its called where you are) as its not all done at the same time the world over.

LizR 171 Posting Virtuoso

So you didnt look.
and before you say you did..

I typed

DateTime.ToString("dd mm yyyy");
placed cursor on ToString
Pressed F1

Got help
Clicked on the datetime format string stuff

http://msdn.microsoft.com/en-us/library/az4se3k1.aspx

which has a second link to

http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx

You are just plain lazy

LizR 171 Posting Virtuoso

try the asp.net forum

LizR 171 Posting Virtuoso

OK, so what happened when you did it..
You know how it goes show your code, show what happened, show what you found but werent expecting..

LizR 171 Posting Virtuoso

Have a google, its called recursion.

LizR 171 Posting Virtuoso

Well, your bmp, is it done the standard way of having in effect the 8 pictures side by side in say a 2 row, 4 column format? If so you have to copy the relevant "frame" out of that picture and place it on the screen

LizR 171 Posting Virtuoso

Take a read of the helpfile, there are many date/time formats, its very simple, but you should start reading for yourself what options you have.

LizR 171 Posting Virtuoso

if you mean the event where a user presses windows+L or ctrl+alt+del+lock do a google on windows hooks and locking screen

LizR 171 Posting Virtuoso

Well. Debug, watch what happens as you go through the stages.. Especially looking at the newFont.Style property

LizR 171 Posting Virtuoso

Um, you could put exactly that in (with double \\ marks obviously) why what problem you having with it?

LizR 171 Posting Virtuoso

Depends, if the code comes with a PAS file with all the APIs you will need defined, use it. If it doesnt and only c code you will need to change a few variable types and depending on size of project, would say either add the function definitions on the top of your current unit, or make your own separate file (recommended thing to do ) to use.

LizR 171 Posting Virtuoso

if the white border is in the graphic, first thing Id say would be remove it from the graphic, if its not, you could consider programattically making the picture smaller..

LizR 171 Posting Virtuoso

OK, so whatever "cleartool.exe" does, you have a filename, do you know how to run cleartool.exe on a specific file from a command line for example?

LizR 171 Posting Virtuoso

I was trying to get you to look at the datetime functions for yourself to find the things like tryparse..

Perhaps you will now try and do a search on date time formats.

LizR 171 Posting Virtuoso

Have you considered that you are reinventing the wheel?
Perhaps there is a function of the datetime variety that will do all this for you..

LizR 171 Posting Virtuoso

Please search this forum, this has been answered a number of times before.

LizR 171 Posting Virtuoso

error 2 is caused by

string[] allData = sr.ReadLine();

Read what it says. It tells you what the ReadLine returns, and whats wrong with your line.

The first error is to do with your second error

LizR 171 Posting Virtuoso

Sure.

try google

LizR 171 Posting Virtuoso

You've not bothered with code tags which makes reading it difficult
you redeclare secArray as a local array, so its out of scope.

LizR 171 Posting Virtuoso

best answer get a book and follow through the things it asks you to make

LizR 171 Posting Virtuoso

With everything in .net being a class/object, what I think he means is if you were in c++ or any other lanugage, a data type such as int/string/char etc has no methods, its a datatype, whereas in .net, of course it has methods.

LizR 171 Posting Virtuoso

then convert the strings to the same casing and test after.

LizR 171 Posting Virtuoso

No code tags?
Whats the error? symptom?


other than youve said pick is a char, and then asked if its 'flip1' as a string, so i guess it always says you lose.

LizR 171 Posting Virtuoso

ah but then you'd expect the bits to be circles not squares :P

LizR 171 Posting Virtuoso

Um, just like I showed :P

LizR 171 Posting Virtuoso

OK Ive seen worse, although you should check that your openConnection doesnt return null in your Main.

Socpe.. Scope is a little like a line of sight.

If i had

private void  Something()
{
  int i;
  i=5;
}

private void other()
{
  if (i==5)
  {
      Console.WriteLine("I is 5");
   }
}

It would fail because i is only visible to the first function.

Most likely you would only open a connection to your database once. You wouldnt repeat it, so while having a separate method is a good idea, for this is has no major reason.

However, your inserting of data section would have a point :)

LizR 171 Posting Virtuoso

OK do you know what "Scope" is?

LizR 171 Posting Virtuoso

We tend to be short fused with the new people because they dont bother to read the announcements at the top of the forum, they kinda post "My stuff dont work, fix it" .. sure some of the "my teacher doesnt help" stories will be true, but the problem is for all the times we do something for someone there are probably less than 1 in 100 who will actually work out why you wrote what you wrote, the rest will go "next" and do something else.

All humans are inherantly lazy.

LizR 171 Posting Virtuoso

This is why you need to design what you're going to do before you code it.

The thread needs something to run, so the thing you want to run has to be separate from the method you're in right now.

You might consider sending the thing to be run by the thread a parameter - take a look at the helpfile for threads for examples

LizR 171 Posting Virtuoso

most languages dont like you messing with the itterator. You would do better to use a while loop.