Killer_Typo 82 Master Poster

I think it means the author of the book was tired and miss-typed :)

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

Using a MediaTracker is definitely a good idea: a MediaTracker will allow you to pre-load images on a loading screen and bypass any issues you may encounter with loading images on the fly - such as awkward display issues and not being able to get dimensional information on the image until after it has been drawn to the canvas.

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

In the android environment all files are created in MODE_PRIVATE!

Each application is run by its own user: any files created by an application can only be accessed by that particular application. Setting MODE_PRIVATE to the file is simply an option available as you can set files to be public-accessible.

However, if a user has root access to their phone they can CHMOD or simply pull the file off of the device. From an applications perspective, this is unlikely to happen as they would have to know the package namespace (com.google.etc.yourapplication) of another application as well as have the proper system access to change file permissions for which it does not have access - which is a permission reserved for ROOT and I believe applications are run as regular users and not root users.

Killer_Typo 82 Master Poster

http://www.eapps.com/

I've used them for quite some time, good pricing and a TON of control over the server. Great service and a ton of FAQ documentation to cover some of the various tasks one would setup: Tomcat, Glassfish, SSH, SFTP...etc

Killer_Typo 82 Master Poster

when I graduated from college I wrote a multi-threaded database administration tool. Has lots of use if you cover more than just a SQL entry pane. If you include functionality like, creating, removing, updating, adjusting tables...etc

Killer_Typo 82 Master Poster

>I found the best book to be google
Yes but sometimes you need a flow to what you are reading which is hard to get given the fact that you are looking up different articles written by different authors scattered all over the internet.
Also when you read different articles by different authors you would sometimes find them contradicting each other a bit, because every author has hos own style, his beliefs his own "best practices" etc,
I am not saying that this isn't a good way, yes it is, but for a beginner not a preferred way to begin with.

as a beginner my first C++ book was a C++ primer that covered basic loops and pointers, I know pretty much dig through google for the rest. WHile many articles can seem to contradict eachother it evens itself out in the end. Nothing wrong with a large amount of code exposure. In my experience I have found pocket references and super thin primer style books to be the best. Heck - even a Java Spark CHart rocks, it's straight to the point and easy to follow. It's only 2 pages :P

I may be an exception to the rule, but I find books to be better suited as a backup. The books I prefer to keep in my library are cook books and pocket references who knows, maybe I am just a bit weird ;)

>Given a good compiler (NetBeans or Eclipse)
These …

Killer_Typo 82 Master Poster

I found the best book to be google and the best tutorials to be whatever the mind can conceptualize into the digital world.

I have been writing software since the 6th grade (C++ and Java more recently) and I must say I learned the most when I took every day computing tasks and wrote applications to solve the problems.

Java is a very neat language in that you can very easily get up and running with it given you've got the time and patience to do so (almost contradictory I know haha :P )

Given a good compiler (NetBeans or Eclipse) you can begin serving JSP and servlet based applications almost immediately and can go spiraling up from there.

So to make a long bloated story short, find something you like to do on your computer or something you find boring enough - and write a solution to it.

I started with files manipulation: moving files, searching for content, manipulating contents...etc and progressed from there. I've since dived into servlet applications, image meta data manipulation, service bus implementations, student loan calculators, database administration applications, multi-threaded apps, web sniffers / harvesters...etc

You never know where the fingers will take you :)

Killer_Typo 82 Master Poster

.NET only works on windows and you need to use Visual Studio for it

you dont need to use the visual studio environment for .NET but it sure does make coding a hell of a lot easier :P

Killer_Typo 82 Master Poster

I use Microsoft Visual Studio Professional

if you are just starting out i would recommend the express versions.

I've dabbled around in other IDEs and with other compilers but i happen to like the MS Vis-studio IDE /Compiler the best.

The MSDN Library microsoft offers is very compiled as well.

Microsoft all around has taken very good care of it's programmers.

Killer_Typo 82 Master Poster

Aside from the major syntax and naming issues:

thats because your array of 20 looks like

Rudolf00000000000000
--------------------

// each 0 is actually a null character

where as the array you specify looks like this

Rudolf
------
Killer_Typo 82 Master Poster

check out http://support.microsoft.com/kb/319257

it really should be as simple as Console.Clear()

Killer_Typo 82 Master Poster

hi, thanks for your reply.............is it really that simple? Thanks

why not give it a shot ;)

System.Console.WriteLine("hello world");
System.Console.clear();
System.Console.WriteLine("Hello world again");

give it a shot.

Killer_Typo 82 Master Poster

System.Console.Clear();

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

your code worked and compiled fine for me (besides a typo in your post)

what exactly are you referring to as not working?

cout<<toupper(*pos)<<" "; //without cast it doesn't work, why?

while it does work the output from it may not be what you are expecting. the output from toupper is int not char, so when it is cout'ed the result is going to the ascii equivalent for the character.

*pos=toupper(*pos); //and this also doesn't work
cout<<*pos<<" ";

*pos is pointing to the character that the iterator is on (my wild guess) so it can be cast back to char without an explicit cast.

but it compiles and runs fine on my end :)

but if you are wondering my output from running this:

A 65 A
B 66 B
C 67 C
. .. .
Y 89 Y
Z 90 Z
Killer_Typo 82 Master Poster

Here is a version I wrote based on your code and heavily commented :)

#include <iostream>
#include <fstream>
using namespace std;
int main( void )
{
 ifstream inFile;   // create a file reader
 inFile.open("vowels.txt"); // open the vowels.txt file
 char ch = '\0';    // holds each letter for testing
 int numz = 0;    // number of vowels counted
 
 // get the string from the file specified
 if (inFile.is_open())
 {
  while (inFile.read(&ch, 1))
  {
   cout << ch; // output the character
   switch (tolower(ch)) // test the character
   {
   case 'a': case 'e': case 'i': case 'o': case 'u': // what about sometimes Y too?
    numz++; // incriment the counter
    break; // stop the switch
   }
  }
  cout << endl; // close off the sentence
  inFile.close(); // we are done reading the file close the stream
 } else {
  printf("Failed Opening Stream\n"); // oops we couldnt open the stream
 }
 // show the user the number of vowels
 printf("The number of vowels: %d\n", numz);
 cin.get(); // wait for user input before closing
 return 0;
}
Killer_Typo 82 Master Poster

Make sure to test if the stream is open

inFile.is_open()

if it's not open your vowels.txt file is in the wrong directory.

that being said if you want I can PM you a working version, a little simpler, but i will wait till you struggle through a bit more before posting it :P

either way you've made good progress.

EDIT:

please remember that HI HELLO would look different than Hi Hello, your current statement would not count the vowels in the first uppercase version.

Killer_Typo 82 Master Poster

yes it can be a bit of a pain at first but using the windows api it can be done :)

this is of course in windows, you need to specify the OS for a more specific answer.

http://msdn2.microsoft.com/en-us/library/ms632587.aspx

Killer_Typo 82 Master Poster

i did a google on the error you posted but didnt get much (put it in quotes to hope to find someone with the same error)

doing a little rearranging this was the best i could find

Memory Leaks


A memory leak is a loss of available memory space. This occurs when dynamic data are no longer needed in the program, but the memory that is used has not been deallocated. It can also occur when an assignment is made to a pointer variable that already holds the address of an allocated area.
Each time a memory leak occurs, the application drains the available memory pool. Even in virtual-memory systems, the gradual increase in application size can result in performance degradation that affects the entire system. Eventually, this performance degradation can lead to a fatal out-of-memory condition that may be encountered by an application unrelated to the one that caused the memory leak in the first place.
Tip: make sure you match allocation calls with deallocation calls when doing unit testing, particularly where there might be an early return from a function where dynamic data was allocated. It's also essential to check, before assigning to a pointer, that the memory accessible via that pointer is freed prior to the assignment or made accessible some other way.

Killer_Typo 82 Master Poster

post your code please :)

Killer_Typo 82 Master Poster

since you are using VC++ i am assuming you arein the .NET framework?

do you happen to be working with windows forms?

System::Windows::Forms

if so then you can capture keyboard input very easy on any form.

Killer_Typo 82 Master Poster

http://www.cplusplus.com/

great resource, i use it for the most part.

Killer_Typo 82 Master Poster

this thread is over two years old, please allow it to rest in peace.

Killer_Typo 82 Master Poster

The idea here is to make each character in the string exist in every position, for example:

string is "JOY"

so taking J:-
1st pass: "JOY"
2nd pass: "OJY"
3rd pass: "OYJ"

taking O:-
1st pass: "OJY"
2nd pass: "JOY"
3rd pass: "JYO"

taking Y:-
1st pass: "YOJ"
2nd pass: "JYO"
3rd pass: "JOY"

then remove the repeated results, and you'll get all the combinations for that string

great post.

actually gave me some ideas on how i would personally tackle this problem.

Killer_Typo 82 Master Poster

to get a random within a range

int min = 33;
int max = 127;
int range = (max - min) + 1;
 
//now generate some random numbers
int somerandomnum = min + (int)(range * rand() / (RAND_MAX + 1.0));
 
//method will always generate a random number within range
Killer_Typo 82 Master Poster

Thank you very much. Appreciated.

I think the function will reach to zero time on sunday. That is what it does. It does not change

But can you please suggest how can I make this function more efficient as it is not very efficient with the use of too many while loops.

the most efficient method is going to entail determining the difference between what you have and what zero is and then subtracting by that ammount instead of continually removing one unit at a time.

so if you have 42 seconds instead of just removing one remove 42

if you have 39 minutes instead of just removing one minute at a time remove all 39.

this completely eliminates the while statements.

Killer_Typo 82 Master Poster

Wrtie the "itr = strv.begin();" after the cout...

I think when you initialize itr = strv.begin(); at the beginning of the code the itr points a random value at memory and when cout attempts to write this value it causes an error.

But when you initialize the "itr" after the loop, the "itr" points the first user defined element in the list and when cout attempts to output this value it doesn't cause an error...

you are correct in that it fails if you assign the itterator before you have placed any values into the vector.

Killer_Typo 82 Master Poster

found the second bug

while( str_time.substr(14,2) != "00")
{           
    str_time = format_time( input_time );
    input_time -= 60;
}

the reason this is incorrect is because the output time is formatted before the new time has been calculated thus the str_time format time will always be incorrect. the loop would continually get stuck forever.

Killer_Typo 82 Master Poster

use this

cout << (*itr++).c_str() << endl;
Killer_Typo 82 Master Poster

i will check it but also you should try running it a few times to see what happens.

EDIT:

also please include any headers and other functions you may have defined :)

Killer_Typo 82 Master Poster

Seems like someone asked the question, some else read read the answers and followed up with more question and finally someone understood all and thanked. :)
If solved mark the thread as solved..

the information provided in this thread has been an awesome resource.

at first i was going huh? ** or *& but now it makes sense to me :-D


http://www.cplusplus.com/doc/tutorial/pointers.html

is a recomended read for anyone confused about pointers.

i read this site one nite and had somewhat of an epiphany lol

the site helped me to understand pointers and their usefullness.

Killer_Typo 82 Master Poster

I haven't yet started this assignment for I have to submit my E.V.S PROJECT within the next 2 days , so I am really busy in that.

On another note, I wanted to know what are actually random nos., because I have often seen all of you using it quite a many times.

what are random numbers?

just that random numbers :D

http://www.daniweb.com/forums/post394829-10.html

this is an array pointer example i wrote, but it deals with random numbers :)

Killer_Typo 82 Master Poster

Thank you so much for the SUPERB explanation .

Now I would try out a program that implements insertion sort and see to it whether I am successful .

Loads of thanks once again. :)

now it's time to write your own insertion method :D

no better way to learn than with your very own hands :)

Killer_Typo 82 Master Poster

based on these two methods is there any gain over one, is one safer than another?

Killer_Typo 82 Master Poster

now that im awake i will try to explain this some more lol! :D

#include "stdafx.h"
#include <cstdlib>
#define length(a) (sizeof a / sizeof a[0])

i've included the cstdlib to gain access to rand and RAND_MAX so i can generate some random numbers.

Also note the define, i have created this define to find the length of an array, since the sizeof returns the byte size of something and not the actual number of elements i need to get the actual byte size of an int and the the array and divide em out to get the total number of elements (or so i believe that is what is going on lol)

void ArrayGenerator(int * MyArray, int ArraySize) {
    int lowest = 1,
        highest = 50,
        range = (highest - lowest) + 1;

the lines lowest, highest, and range are used to generate random numbers within a certain area, i just happened to want numbers between 1 and 50, you could very easily modify the function to require arguments specifiying the range

//act like we are generating random numbers
    for(int i = 0; i < ArraySize ; i++)
    {
        *(MyArray + i) = lowest + int(range * rand() / (RAND_MAX + 1.0));
    }
}

these lines are pretty simple, while im less than the array enter a random number into the array at the pointed too position

*(MyArray + i) states to go to the location pointed at plus whatever 'i' is.

int _tmain(int …
Killer_Typo 82 Master Poster

some code i wrote that basically does what you spoke of

#include "stdafx.h"
#include <cstdlib>
#define length(a) (sizeof a / sizeof a[0])
void ArrayGenerator(int * MyArray, int ArraySize) {
    int lowest = 1,
        highest = 50,
        range = (highest - lowest) + 1;
    //act like we are generating random numbers
    for(int i = 0; i < ArraySize ; i++)
    {
        *(MyArray + i) = lowest + int(range * rand() / (RAND_MAX + 1.0));
    }
}
 
int _tmain(int argc, _TCHAR* argv[])
{
    int FillThisArray[10];
    int * fillArray = FillThisArray;
    ArrayGenerator( fillArray, length(FillThisArray) );
 return 0;
}

this function takes a pointer to an array so i can write code and pass it an array and have it modify the original array and not have to worry about returning anything.


It's pretty neat and now i think im going to go to bed, it's 1:30 in the morning :-X

sorry if it's a bunked (what i said) as i am tired right now :-P

Killer_Typo 82 Master Poster
Killer_Typo 82 Master Poster

I have 2 issues:rolleyes: :

1. I'm creating a combobox from inside code (sort of dynamic, when the user finishes a row, another row appears) and I would like to know how to set the list of items the user chooses from.

is it possible to see a snippet of what you are doing?

are you stating that if they do something in A then a new combo box is created dynamically on the form at point B and you need to know how to modify it?

but the easiest way to add data to a combo box is by setting the range of items to choose from

_MyComboBox.Items.AddRange( new string[] {
"ITEM 1",
"ITEM 2",
"ITEM 3",
"ITEM 4",
....
"ITEM 10" } );

2. How can I block the user from typing custom values into a combobox, but still accept when they select an item from the list?

Thanks;)

change the combobox to a dropdownlist in the dropdownstyle combo box settings and the user cannot enter a string in anymore, just select from the list.

Killer_Typo 82 Master Poster

without thuroughly going through your code the best i can give you is this:

try not to specificy the location of tyour database from the connection string.

(which is what it appears you are doing).

if you are using an SQL server like SQL Server or MySQL it is quite simple to establish a connection.

simply give the driver, the username and the password.

open the connection and then using SQL select the database you wish to use.

have you also tried using break points to see at which point in the code it is actually failing at?

you could just be missing something very simple.

EDIT:

also this seems to be an ACcess database, is this using OleDB or ODBC?

there is a difference in the string used to connect.


ODBC:
Driver={Microsoft Access Driver (*.mdb)};Dbq=C:\mydatabase.mdb;Uid=Admin;Pwd=;


OleDB
Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\mydatabase.mdb;User Id=admin;Password=;

Killer_Typo 82 Master Poster

I have a similar question.

My IT department has disabled my display properties at work (when I right click on the desktop and click properties I get "your computer administrator has disabled the display proerties". If I change the registry value will they know about it ? Also recently they made it so I cant adjust the time.

the delk, welcome to the forums, but all new members are reminded to please not piggy back other threads, though your problem is just as important, it is also important that your issue is addressed seperatly.

Killer_Typo 82 Master Poster

i just signup to ask you to show me the basic and advance script for creating a online game startup bot

though i personally dont know how to do this, you are going to need to give alot more info.

like what game is it, how do you connect to the servers, what does the bot do, how does the bot connect...etc

Killer_Typo 82 Master Poster

http://www.cprogramming.com/

this should help some.

Killer_Typo 82 Master Poster

how do i use c programing

post in the appropriate forums for the best answer, but the best place to start is with a book and some tutorials. You probably wont be programming games for a long time, but with dedication you could be off to a good start if you read books and can absorb what you read.

Killer_Typo 82 Master Poster

There is big difference between C and C++. "Most everything" is written in C.

actually alot of things are writtin in C++ and i know the difference. to a certain degree i do know the difference, i dont claim to have all the knowledge, just enough that i do know the difference.

Killer_Typo 82 Master Poster

I think C++ has been always kind of dead. The only major software i can think of that was written in C++ is Mozilla and Qt (Even though major implementaion of these software was rendered in C). I don't know why people like C++ so much, when you can achieve object oriented design through C. GTK and Gnome are perfect examples of that. Plus a lof of people still prefer writing code in pure Win32 API rather than messy MFC.

True object orientation cannot be achieved without a true Object Oriented Operating System.

your joking right?? lol C++ already kind of dead. ill laugh really hard at that. then remind you that most everything is writtin in C++, not just one webbrowser.

Killer_Typo 82 Master Poster

i told my dad what the guy said about C++ dyin a slow death and he laughed his ass off, and thought it was the funnies shit he had heard. hes been coding for oooo since he was about 20, and hes in his late fourties now, so when he heard that he was laughing soo hard becaus he knows that java could never beat out C++, he explained it better than i can right now, but if i can ill get him to say it again, because all his points were valid and good and probably would make a better impact then anything i could say.

Killer_Typo 82 Master Poster

Thanx Hexstar for the reply...will try doing that....

Also Caperjack, would have been just fine without ur reply....i believe such forums are to help people with knowledge that u have & u can share...not for such replies as yours.....leave that for chat sessions

your failing to see what you asked and as a result you dont see why he responded as such. you were asking for the administrator password on a computer that might not be yours, for all we know your not supposed to have access to that, and your just looking for a way around it. you could also be some little kid that just wants to get around a porn block that your parents put up, or trying to do somthing you shouldnt. Asking for a way around a password with no proof that you are the administrator or just forgot, or your not just trying to gain access to a computer thats not yours is not right.

Killer_Typo 82 Master Poster

how to remove web hancer completely


What does remove WebHancer:

  • Use Ad-Aware to remove WebHancer, remove everything from the 'Communications' section in Windows Setup (Control Panel, Add/Remove software, Windows Setup), delete the Registry key HKLM\System\CurrentControlSet\Services\Winsock2, reboot, put removed items from 'Communications' section in Windows Setup back.