Killer_Typo 82 Master Poster

yes when you call any accessing elements of an image the image is loaded at that time.

If you were to say create a new Image on "/myImage.jpg" and then call image.getWidth() it will return -1 until the image has been loaded.

Try this out in debug, call image.getWidth() and debug that line, if you call it again after a second or so (probably less, but it's a decent enough buffer) the image will finally be loaded.

It's an asynchronous process so that you don't go new Image("some massssssive image") and end up waiting a long time for it to display.

Using ImageBuffers and MediaTrackers are great alternatives since you can get the images immediately. These also allow for smarter handling of the images, which is really what most people want.

Killer_Typo 82 Master Poster

Then it is not a primary rule for basic bean specification? I have not learned getter and setter methods in object oriented programming.. Now only i am hearing.

In Spring (beans) the primary purpose of a bean is to abstract you away from the class and encapsulate the code and allow it to be populated via another means. You can load your class variables up using a spring bean file. The underlying code is usually a class of basic getters/setters with some implementation.

As for getters/setters

Getters and setters allow you to wrap data elements with meaningful code that the callers of said method would never need to know.

For Example

public class foo { 
  public int width;
  public int height;
  public Image image;

  public foo() { } 

}

By exposing those elements directly your user has no inclining into the manner in which they should be connected together. Is that width and height for something else, is that width and height of the image?

By exposing your code via getters and setters you can write impl code that will allow callers to use the methods without worry of the underlying happenings of the class.

public class foo { 
  private int width;
  private int height;
  private Image image;

  public foo() { } 

  public void setImage(Image i) { 
    image = i;
    width = image.getWidth(null);
    height = image.getHeight(null);
  }
  public int getWidth() { 
    return width;
  }
  public int getHeight() {
    return height;
  }
  // Here we …
Killer_Typo 82 Master Poster

Programming is not just something you do, it is a passion. If programming is not a passion you are not going to find a magic pill or answer that will get you on track.

In 10 years if you feel you haven't gained much then you should assess why you are doing it in the first place.

Part of the problem with coding is that it's easy to lose focus and never finish a product. A lot goes into creating the perfect application, that one sweet bit o code that when all compiled together makes your pants fit just a little bit tighter.

Spend some time researching what you want to do and dedicate yourself to it. Get yourself hyped up and psyched out. You want to be passionate about whatever you are creating or it will show in the work (lack luster results). You need a clear plan of attack, from what the program is, down to how it will work.

You need to think about:
User Experience
User Interface
What the program does
How the program does it

Component-ize your work, set clear goals and meet them. Don't just say, "I want to create a video game" and get frustrated when you don't meet the goal, that goal is too generic and doesn't really allow you to feel the fruits of your labor.

Example:
"I want to create a side scroller like mario"
What should the …

Gribouillis commented: great +13
Killer_Typo 82 Master Poster

You can guess it from his question!

I really don't think he's given enough information for anyone to try and say what the error is.

considering the .NET framework is automatically downloaded on newer OS's and in fact comes pre-installed with newer releases of XP/Vista CD's it would be fairly safe to say that any newer system would have the required framework.

Now that is not to say it's not impossible for him to find someone without the .NET framework but it is a bit foolish to spit out an answer without first knowing what is really wrong ;)

that's a bit of troubleshooting 101.

Nick Evan commented: Yup. Crystal balls aren't my hobby either +6
Killer_Typo 82 Master Poster

thanks for your answer,


my mistake, yes the code compiles but the 3 statements have different bahaviours....


yes, but according to this

//Program creates char d, sets it equal to lowercase letter
//Converts it to uppercase and outputs it
#include <cctype>
#include <iostream>
 
using namespace std;
 
int main()
{
    char d='a';  
    d=toupper(d);
    cout<<d;
}

it should print the character not its ascii value.... I found the code here...

this statement is entirely different from what you have in your code.

/* 
toupper returns an INT value
toupper(a) will return 65 the ascii value for an uppercase A
*/

// the following statement will output the ascii value for the character
cout << toupper(a);

// the following statement will cast the INT value to the equivalent CHAR value
cout << (char) toupper(a);

Notice how i had to cast the output from the toupper function to char to get the character output.

By default the return type of toupper is INT not CHAR so to output the results directly will output an integer value not the character equivalent.

The reason your code works (whether or not it throws a warning) is because there exists an implicit cast from INT to CHAR.

So a user can create a CHAR and assign an int value to it.

/* for the following examples the compiler will automagically cast the INT values to CHAR without the use of an explicit cast*/
char mychar = 65;
cout …
n.aggel commented: thanks! +1
Killer_Typo 82 Master Poster

The Problem is using the method

g.DrawString("Text in Picture", new Font("verdana", 12), SystemBrushes.WindowText, 0, 0);

I put the settings for visual appearance in remarks and still get the same problem.
When not using the method DrawString and only saving the file with Bitmap.save the picture stay with the same size.
Why the method DrawString is resizing my picture?
Thanks

i would assume that because you are drawing on the image when you save the image the compression is re-applied to the image.

Killer_Typo 82 Master Poster

>simple and it works
Your code exhibits undefined and implementation-defined behavior (start a new thread asking why if you want details). It also alters the words, which won't work for us, we need the words to be reversed without also reversing the characters in each word. But it's a start.

cool i started a new thread.

so from what i am gathering if i were to input the string

hello world

you dont want

dlrow olleh

you want

olleh dlrow

the words reversed but their location is intact?

:)

i figure i should ask questions now rather than later :P

iamthwee commented: I hope you are joking, how does "reverse words" mean reverse "letters" :D +12
Killer_Typo 82 Master Poster

vectors are much like arrays

#include <vector>
int main()
{
//standard way to create an array
int myarray[someconstsize] = { 0 }; //assigns all values to default zero
 
//vector declaration
vector<int> myvec;//declares an int type vector
 
//adding data to them
 
myarray[0] = 4;
 
myvec.push_back(4); //adds four to the end

this is in no ways the end all be all deffination, but a somewhat decent look at em :)

iamthwee commented: You explanations are sooo cute! +12
Killer_Typo 82 Master Poster

easy!!


this is more of a command shell question though :-/

seperate each command with the & symbol

use a && to ensure that the following command is only run if the previous was successful

so to go up a directory and get the contents

system("cd .. && DIR");
 
//or
 
system("cd .. & DIR");

the only difference is that the first version only executes if the initial cd .. executed correctly else it will not continue the second version executes each command no matter what.


BTW a good read http://207.46.196.114/windowsserver/en/library/44500063-fdaf-4e4f-8dac-476c497a166f1033.mspx?mfr=true

Killer_Typo 82 Master Poster

If you are still interested a few things you could do / should do.

get an XML Parser and treat all pages like XML, since HTML follows a strict coding format (or at least properly built pages do) you could easily build a parser using an XML tool.

Secondly since it is going to be command line i am assuming no reason for graphics, so again it's just a matter of parsing the text and other style/placements

but then you get into the issue of the Styles.

because the grounds on how each browser displays is so poorly implimented by each side (microsoft,firefox,safari...etc) it would be in your best interest to look up the DOM (document object model) as well as http://www.w3.org/ as they are the people that set forth the guidlines.

Killer_Typo 82 Master Poster

First of all it is Node not Nod.

the only way to add check boxes to the node tree is by specifying it on the TreeView object itself, thus all of the nodes will have checkboxes.

but in your example it would be

treeView1.CheckBoxes = true;

another method (if you are seeking to only have it on a few and not the entire tree) is to use an image list and keep track of which nodes are visually marked with your custom check or not.

iamthwee commented: good +11
Killer_Typo 82 Master Poster

lastnight when browsing daniweb i realized something.

when i first started browsing this site back around 2004 i was offering PC troubleshooting support. I spent most of my time on this site offerent support for others at zero cost because i love to do that sort of thing.

Around that time i was dabbling in C++ and other languages and the thought of doing that full time was just that, a though.

Now today three years later I'm being payed very good money to develop software on a daily basis and I love it.

Just funny how my computer skills have evolved so much. I want from a young fledgling noob that liked to tinker with computers to writing software for clients :lol: all that I just turned 20 this year :icon_eek:

Killer_Typo 82 Master Poster

i believe you can, you can wake the machine through the NIC card (wake on lan)

let me look it up for both ya!

.....done researching


yes you need whats called Wake-On-LAN

http://gsd.di.uminho.pt/jpo/software/wakeonlan/mini-howto/ --miniHOWTO
and sometools

http://gsd.di.uminho.pt/jpo/software/wakeonlan/mini-howto/wol-mini-howto-3.html#ss3.2

'Stein commented: Good find! :) -'Stein +3
Killer_Typo 82 Master Poster

If you want to learn c++ properly, try coding your problem from the command line only- i.e no GUI. (I know it may be hard coming from c# or a java background but if you do it that way you'll pick up better habbits regarding program speed and efficiency. After all isn't that why you wish to learn c++?)

There are of course better suited languaged you can use to parse xml files than c++. However, if you want to do that look at the methods availabe for the std::string class.

cool, i will take that into consideration. Most of what i got to work came straight from the MS website;although, the first language i have ever worked in was C and that was a long time ago. Then i tried out C++, didnt like it, and moved to just HTML (not a language i know!) then to PHP and then onto MySQL; i am currently dabbling in JavaScript and decided it was about time to come back to a real mans language :lol:

Killer_Typo 82 Master Poster

Are you using microsoft's managed extensions for C++ (.NET in VS 2003)? You might want to consider using C++/CLI instead for .NET programming (you can download Visual C++ 2005 Express for free). Keep in mind though, that C++/CLI is really its own language

Already using Microsoft Visual C++ (in .NET 2003)

my school has an academic alliance with MS so i can get access to all of the tools and OS's they offer for free. so to be honest im using what is offered on their site.

the version is
Microsoft Visual C++ .NET 69462-335-0000007-18585

Killer_Typo 82 Master Poster

awesome, thank you very much! i will look into that immediately!

Killer_Typo 82 Master Poster

Howdy there all again. I have been working in C# for some time and think i am ready to graduate to a real language that can actually work hand in hand with memory managment :P

so my first venture is to write a piece of software that will open a file and allow me to make edits to it (it will be an xml file that contains information for my customers)

My current problem is that i do not know how to open a file for reading.

i have no problem calling the file reading ability of C++!! but it is very confusing to me at best. This was easily done in C# but then again im not supprised, my dad calls that language a sissy language :lol: (he's been programming since pascal and fortran! punchcards for the win)

so basically ive looked online at some tutorials but im not quite sure what to do.

i just want to open the file for reading and read through it line by line parsing out the input from the file looking for certain strings of text that need to be edited.

im not worried about the former part, im just interested in learning out to open files for reading!

thanks to all that can help, if any more information is needed just say so!

Killer_Typo 82 Master Poster

got to thinking that i couldnt find a way to find the intersect of a string and array nor could i find a quick way to do an array / array.


i searched a bit on google and didnt really find anything that showed me something like

Array.Intersect(array a, array b)

so i wrote my own :)

i hope this helps someone out there. even if there is a faster way it is nice to discover how things were/are done.

array vs string intersect.

public static string Intersect(string[] arrayA,string intersectObject)
{
int arrayALength = arrayA.Length;
int count = 0,
maxCount = arrayALength;
string strOutput = "";
//this is only going to find one intersection. thats all i really give a hoot about
while(count >= 0 && count < maxCount)
{
if(arrayA[count] == null)
{
//if it finds a null value
arrayA[count] = "";//insert a blank space
}
if(arrayA[count].Equals(intersectObject))
{
//if it finds an intersection
strOutput = intersectObject;
}
count++;
}
//return the results
if(strOutput != intersectObject)
{
strOutput = "false";
}
return strOutput;
}

array vs array intersect

public static string[] arrayIntersect(string[] arrayA, string[] arrayB)//returns ONLY the first found strings in common between array A and array B
{
//count the length of both arrays
int intArrayA = arrayA.Length,
intArrayB = arrayB.Length;
//Find Max array size if all vallues from shortest match all the values from the biggest
int intMaxOutput = 0;
string[] longArray, shortArray;
if (intArrayA >= intArrayB)
{
intMaxOutput …
alc6379 commented: Great coding! +9
Killer_Typo 82 Master Poster

i just want to state that anyone who sais that linux is by far more secure, has no idea what they are saying. Security in any operating system is a myth. there are by far more windows users than linux, so people spend more time trying to crack through windows because they can affect a larger target group. One thing about hackers (and i use that term loosely) is that they (again this is a generalization and not a everyone is this way) want to be known in that everyone is worried about some new virus, but they dont know WHO or HOW its getting around. if someone launched a massive linux virus...well the public wouldnt care because of how little it would affect....


it would be like...blow up small building in remote town in the middle of nowhere, or blow up a large building in the middle of a large city.

The fact of the matter is, that if any one "hacker" sat down and spent time at an OS, they could crack and abuse the hell out of it, but the reason they pick windows is because they know it will get more attention, and there is already a larger group of people working against windows because most of the good virus writers understand what i am talking about.

About the nobody cares about the Send an Error Report...in actuallity microsoft dedicates time to reading those and finding out what happend and how …

Troy commented: A thorough and unbiased reply. +1
Killer_Typo 82 Master Poster

i believe all computers neeed at least one bank filled with ram, be it the older machines where one bank was around 4 slots, to the new machines of one bank being the slot itself.

Killer_Typo 82 Master Poster

Need some help. Don't know anything about programming except HTML, would like to know where I should start to learn the language. :?:

HTML and programming are soo far about.


HTML Hyper Text Markup Language, its all formating, no programming at all

there is C, C++ and C#, i would recomend C++ and

www.cprogramming.com

good for C and C++ though. C or C++ takes years to get good at, and even more to get truly confident, Read books, do tutorials, and post alot for help.

Killer_Typo 82 Master Poster

been back in school for two weeks, (im a senior this year) and cant wait to get out, move to henderson (to be with my g/f) and start at ITT, as soon as i can start in life, the better.

mikeandike, that was a rude comment, and comments like that are not appreciated, what someone chooses to do in life compared to you is their choice. what you may think 'stupid' someone may find to be the best thing to do. so please keep immature comments such as that to yourself.

Killer_Typo 82 Master Poster

sorry about the spell check i miss a couple of letters it should read " when i try to run your code how come it doesn't stay on the screen so i can see what the outcome is?"
thanks again from a bad speller

open up dos and navigate to the program and run it, then it will stay on the screen. there is also a fix for this too, that will wait for one last piece of input for the user before it closes. but i dont remember the syntax or the command.

Killer_Typo 82 Master Poster

does it say safe mode all allong the edges of the screen?

Killer_Typo 82 Master Poster

im all about the PC, the only reason people think mac is better is because thats what MAC says, if microsoft claimed that then people would be like. oooo see microsoft is better now because they say they are. Really it depends on the machines and the specs, a crappy old mac sure aint better than a pc, and a new mac sure is better than a crappy old PC. but overall, i think PC's are better.

Slade commented: Thanks for the reply :) +3
Killer_Typo 82 Master Poster

try www.sysinfo.org thats where most check their HJT logs against, its got a fairly complete list of BHO's and startup items, and for anything you cant find. just google it.

DuncanIdaho commented: Very helpful post +1
Killer_Typo 82 Master Poster

just put them both in and see if it will post/start. if it doesnt take the 128 out.

dlh6213 commented: makes sense to me, that's what I would have tried/suggested. +1
Killer_Typo 82 Master Poster

as i get more invites ill post more.

cosi commented: You're Awesome. Thanks for the GMail account! : ) +1
Killer_Typo 82 Master Poster

and red lipstick

Killer_Typo 82 Master Poster

well im not getting that error anymore, but heres the new one.

Heres the Error:
You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '123 char (41) ,)' at line 1

where 123 is first row. char is the type, and 41 is the length

and when i try to define one rows as being auto_increment i get this error;

Incorrect column specifier for column 'column name'

<?php
$host = "localhost"; //location of the mysql
$name = "michael"; //user name for logging into mysql
$pass = "engineer"; //password for logging into mysql
$TBname = "$_POST[TBname]"; //name of the table for Creation
$DBname = "$_POST[DBname]"; //name of the database for working in

	$connect = mysql_connect($host, $name, $pass) or die(mysql_error());
	mysql_select_db($DBname) or die(mysql_error());
	
	$sql = "CREATE TABLE $TBname ("; //creates the table
	for ($count = 0; $count < count($_POST[field]); $count++)
	   {
		$sql .= $_POST[field][$count] . " " . $_POST[type][$count];
			
			if ($_POST[auto_increment][$count]  == "y")
			  {
			   $additional = "NOT NULL AUTO_INCREMENT";
			  }
			else
				{
				 $additional = "";
				}
			if ($_POST[primary][$count] == "y")
			  {
			   $additional .= ", primary key (" . $_POST[field][$count] . ")";
			  }
			else
				{
				 $additional = "";
				}
			if ($_POST[length][$count] != "")
			  {
			   $sql .= " (" .$_POST[length][$count] . ") $additional ,";
			  }
			else
				{
				 $sql .= " $additional ,";
				}
	   }
// clean up the end of the string
$sql .= ")";
$result = mysql_query($sql, $connect) or die(mysql_error()); // execute …
Killer_Typo 82 Master Poster

you could probably get more performance by getting more RAM into that computer and purchasing a new CPU celerons are incredibly slow, a 1.8Ghz celereon is like 800Mhz p4

ajelliott commented: Thank you for your suggestions and support. +4
Killer_Typo 82 Master Poster

This is my project thats due tomorrow
can someone do the rest for me?
i am lack of time now....
coz i got my final tomorrow too

they dont do others homework here, your going to have to do it, best that you can hope for is a direction to go in, and maybe some hints, but you cant expect someone to just write all the code for you.

Killer_Typo 82 Master Poster

i dont know very much about c as of yet, but from what happend to me and looking at your source you forgot to add a line for what to do if your choice is somthing other than 0 1, it needs a value for Null (no entry) and all characters numbers from a-z 2-9 (because 1 and 0 are being used they are excluded) because when i just pressed enter the program got stuck in a loop and started spitting a line of text which i couldnt read, as fast as the computer could. also when it asked for a name, it never gave me a chance to enter my name, the program merely proceeded to the next line.