Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

2101.

Solve : which language should i use?

Answer»

Hi I need help, I would like to make a program, but I'm not sure what language I would need to learn and use for it. Here is what I will be USING the program for: a small business where the CUSTOMERS would be choosing an item and then building upon that item by making choice after choice, sort of like building a character, but REALL basic.

thanks for the help, hopefully that was enough info, if not let me know
You COULD use html mixed with javascript for something like that.
A little more info might help.

2102.

Solve : VB Script for windows application?

Answer»

I would like to wow my dad for xmas and write him a script which:

1. Runs the windows remote desktop application (comes w/ vista).
2. ENTERS the ip for the remote machine.
3. Enters his user profile.
4. Enters his password.
5. Completes the connection.

I don't believe this kind of script is supposed to be difficult.
The task of doing it manually is not very difficult.
But then, I'm new to VB script. Any suggestions?

Thanks in advanceI couldn't FIND a WMI class for remote desktop, so this is not very elegant:

Code: [Select]Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run "MSTSC /v:COMPUTER /w:800 /h:600 /console"
WshShell.AppActivate "Remote Desktop Connection"
WScript.Sleep 1000
WshShell.SendKeys "Signon"
WScript.Sleep 1000
WshShell.SendKeys "{tab}"
WScript.Sleep 1000
WshShell.SendKeys "Password"
WScript.Sleep 1000
WshShell.SendKeys "{enter}"

Change Computer to a real computer NAME, Signon to a real logon id and Password to a real password.

Like I said, not elegant but serviceable. I'm sure your Dad will be thrilled to get a script for Christmas.

2103.

Solve : homebrew????

Answer»

I know it is ilegal to emulate a copyrighted ROM, but WOULD it be legal to emulate a homebrew ROM???
If so would you please point me in the RIGHT direction to make a homemade GAME for the GBA? the right direction: here

2104.

Solve : How I can execute Javascript into Perl??

Answer»

I don't KNOW how I can EXECUTE an EVENT of Javascript into a link in a program in PERL.
This event of JavaScript have executed a function that return a HTML page.
Anybody know how I can it?

Is it possible do it this?:
$datos=$datos."""";

What is bad in this code?

Thank you very
MUCH.

2105.

Solve : urgent!!! need help on batch script.?

Answer»

Hi all,

I really need your advise on how to create BATCH script to stop and restart program during backup time. I already know how to create batch script and run it during backup time. the problem is I don't know the command to stop and restart program..

so can someone please help me with this..I really need it..you would probably get more help if you close this topic and repost in the MS-DOS section of the FORUMS. unless you already put this there, thats double posting, DONT do it. remember to close this topic first.

2106.

Solve : Excel Script?

Answer»

what would be the best way to apply if statements and a few other formulas in a AUTOMATED way?
To EXPLAIN a little bit deeper. I am running a windows 2003 server and I have a log file that is captured weekly in csv format. What I would like to do is build a spreadsheet that extracts lines based on a average and if STATMENT in excel (the spreadsheet format is completed). However each week I get a new file and I would like to move that data to excel spreadsheet I have built and replace the old data. This way I could simply have the server email the updated info out weekly AMD NPT have to spend anytime formating the data into the desired format.

Thanks in advance!

2107.

Solve : using another program code??

Answer»

i was on some server page on reagezone that had like, a whole bunch of personal SERVERS for this game, and i was reading some of them and it appeared that people were using other peoples servers and adding on to them to make their own. i was kinda wondering how they did this? maybe is there a WAY to view the source?I'm not entirely sure I understand your question but the site you mention (GOOGLE suggests you're talking about ragezone.com), lists private servers for various MMORPGs. The server software used to RUN these private servers is usually created by people who have reversed engineered the official game clients (or the communication between the client and server) for the various MMORPGs. So YES the people who have created these unofficial servers can add or remove content or change game mechanics.

I've never personally played on a private server for various reasons. One being that I'm already paying to use the official servers and another being that private servers never have as many players as official servers.well yes there are the servers you talk about, but then other people on the forum will take those servers and make fixes and stuff to them

yea ive pay to use the real servers too but i like just trying the private ones to see what it would be like if i had more money and other stuff you cant regularly get.

2108.

Solve : enable msconfig using cmd or batchfile syntax?

Answer»

guys just wana ask f ANYBODY KNOWS how to enable MSCONFIG using BATCH file or command line syntax..TNX n advance..You can use the below command line to start the job. It runs interactively, don't know if you can script this tool.

C:\WINDOWS\PCHealth\HelpCtr\Binaries\msconfig.exe

That will Start MSConfig and so will

@echo off
cls
start msconfig
exit

But how to Enable MSConfig? Has a virus disabled it?

RSVP

2109.

Solve : VB question?

Answer»

Im new to VB (started learning it at COLLEGE about 2 months ago)

now in my SPARE time, im creating a little word processor.

Ive ran into a really noobish problem as i dont know how to do this:

when you CLICK a tool strip button, it inserts it into a rich text box

Say, i want to INSERT a Code: [Select]<hr> into the rich textbox

How do i do it ?

THANKS in advanceCode: [Select]Private Sub ToolStripButton1_Click(ByVal sender As System.Object, ByVal e _
As System.EventArgs) Handles ToolStripButton1.Click
RichTextBox1.Text = "<hr>"
End Sub

Set the Text property for the RichTextBox in the click event for the toolstrip button.

The above example is VB.Net. If your using VB6, it's the same method, double click the toolstrip button in design mode and set the RichTextBox text property to ""

2110.

Solve : graphics in C?

Answer»

Hello,
I am MAKING a project in C. It is a sort of animated movie. I have shown the movements in it but I don't understand how to include voice in it.
I want to record my voice and I want it to play along with the animation.
Is it POSSIBLE in C?
PLEASE help me out.
thanks a lot. Yes, it's possible. You'll need an SDK (SOFTWARE developer kit) for working with sound. Not sure what's out there for sound, but I'm sure Yahoo! knows. thanks mate.

2111.

Solve : program like flash---?

Answer»

pretty MUCH all IM looking for is a PROGRAM like flash ANIMATOR, but FREE...

2112.

Solve : How would I make a simple email client in Visual Basic 6??

Answer»

I am trying to MAKE a SIMPLE EMAIL CLIENT in Visual Basic 6. I searched the internet for email controls in Visual Basic, but the only ones I could find were very expensive. I am looking for a free POP3/SMTP control for Visual Basic 6 that would allow me to make an email client. If there is a way to do this without USING a control, tell me.

Thank You.

2113.

Solve : Stop C# program?

Answer»

What C# COMMAND can STOP the program if FAIL testing??
Do need to click button.

TQ!!

2114.

Solve : File handling capabilities of VBScript?

Answer»

Hello all,

I have been tasked with finding out who has a file locked. Sounds relatively SIMPLE, but there are many interesting variables involved.

So far, we are using a dBASE 5 for DOS program that is DEFINITELY legacy. There are functions within dBASE that need to lock a file exclusive. Which means that only the user within the dBASE environment that has the file locked can use it.

What I was wondering, is if VBScript is able to read that file that is locked by dBASE. The locked file has information on which workstation locked the file and that is what I am trying to access.

Thanks,
MattInteresting question. If the dBase engine applies the lock, the OS may not see the table/file as locked. VBScript may be able to read the table/file.

Have you tried using ADO to access the database?

Code: [Select]Set cnn = CreateObject("ADODB.Connection")
cnn.Open "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=pathtodatabase" & _
";Extended Properties=dBASE 5.0;"

Be sure to change pathtodatabase to something more appropriate. If you can successfully open the database, you should be able to extract whatever information you need.

Good LUCK.

Not much No EXPERIENCE with dBase and as you can see, with the terminology either.

2115.

Solve : Want to program, some direction perhaps??

Answer»

Alright here is the thing, I have never really actually programmed, I used to use VB6, and have used a couple of lines of code in map makers for certain games, I am by no means an 'efficient' or even competent programmer, but I would like to become one. I would like to maybe start on something like a simple game, with a graphical interface of some SORT. I guess my question is where would I start? What do I need? What should I GO in expecting? How much will it COST? Any help is greatly appreciated.

Thanks.Seems a little contradictory about used to use VB6 but have never actually programmed.

Nevertheless, MICROSOFT has Express Editions of their visual languages DESIGNED for the casual programmer.

In addition, Microsoft also has a Games Studio Express (XNA Framework) to help you develop games.

Everything is free. Best of luck.

2116.

Solve : Third time's a charm - Escape game?

Answer»

After another look at my code, and another "what the heck was I thinking" moment, I'm going to try again with the game. I won't make any promises on a completion date, or even on what days I'll make any progress whatsoever. I'm doing this in my spare time, as a student, so I don't think this'll be quick.

For any who missed the last two attempts: Escape is a C++ game I'm writing, command-line driven. It's intended to teach me Object-Oriented programming, as well as problem-solving on a larger scale than the typical "here's a program to illustrate an example" program you see in the average tutorial.

I'm doing this with the full knowledge that, as I post the code, I'm going to get corrections, things I can change and improve, and questions asking for why I did what I did. I need this feedback, as it helps me become a better programmer.

Without further ado, here's what I have so far. This is NOTHING more than the basic classes I'll be using, and the implementation code (I'm working on that). This also includes my brainstorming process as I began this project, which will help show where I'm coming from with my code, my variable and class names, etc.

Code: [Select]/*Program Name: Escape
Program Type: Command-line game
Description: Explore my old house, collect items and use them to formulate a plan to escape.
Program began: 11/17/2007
Program Ended: ??/??/????
*/

/*Brainstorming process

Will need "Room" objects, "Item" objects (for things that can be put into inventory), and
"Interact" objects that can be interacted with, but not put into inventory.

Room objects will need a String "name" that describes the room's purpose, e.g. "Family Room". They
should also have String "descriptions", which can be accessed by entering a "look around" command.

Item objects will need a "name", like Rooms, e.g. "Pencil". They should also have a description,
in case the player chooses to view a description. Some will need other properties, such as battery
life.

Interacts will need a "name". They should have descriptions. They will also need other properties,
depending on the object. These will be stored in vectors, i.e. a "boolean" vector for needed BOOLS,
"int" vector, "String", etc.

A Player class is needed. It should have room location as a variable, and an Inventory class as a
aggregated class. The Inventory class will be a vector, with references to Items as they are placed
in Inventory.

***A parser is needed in another header file*/

#include <vector>
using namespace std;
class Item;
class Interact;
enum flag { TRUE, FALSE, INVALID };

class Room
{
public:
/*At initial setup, vectors should be created with all needed objects, and
passed to the Room constructor.*/
Room(String name, vector<Item> itemCreate, vector<Interact> intCreate);
//Use Default destructor; not using the Free Store.

//Accessor functions
vector<Item> getItems() { return itsItems; } //Returns entire vector
Item findItem(string name); //Searches Items for certain names of Items

vector<Interact> getInteracts() { return itsInteracts; } //Returns entire vector
Interact findInteract(string name); //Searches Interacts for certain names

string getLocation() { return location; }

void describeRoom();
//Describe the room based on a description and items visible in the room.

private:
vector<Item> itsItems;
vector<Interact> itsInteracts;
string defaultDesc; //The default description of the room; doesn't mention items.
string location;
};

Room::Room(String name, vector<item> itemCreate, vector<Interact> intCreate)
{
/*In this PORTION of the code block, add code to parse a text file and
read in the desription in, adding it to defaultDesc*/
location = name;

for(int i = 0; i <= itemCreate.SIZE(); i++)
{
itsItems.push_back(itemCreate[i]);
}

for(i = 0; i <= intCreate.size(); i++)
{
itsInteracts.push_back(intCreate[i]);
}
}

Room::findItem(string name) //For "take item" type commands.
//Similar function for Inventory class should be used.
{
/*Search the vector array of Items for one with a particular name. Return the Item if
it can be found, and throw a NO_MATCHING_ITEM if it can't be found.*/

for(int i = 0; i <= itsItems.size(); i++)
{
if(itsItems[i].settings[0] == name)
return itsItems[i];
}
throw NO_MATCHING_ITEM;
}

Room::findInteract(string name) //For "use item" type commands for within a room.
{
/*Search the vector array of Items for one with a particular name. Return the Item if
it can be found, and throw a NO_MATCHING_INTERACT if it can't be found.*/

for(int i = 0; i <= itsInteracts.size(); i++)
{
if(itsInteracts[i].settings[0] == name)
return itsInteracts[i];
}
throw NO_MATCHING_INTERACT;
}


class Item
{
public:
Item();
/*The following variables are made public so that the findItem and findInteract
functions can work faster, by not requiring a "get" function to be called multiple
times in a loop.*/

vector<string> settings;
/*In the above vector, the first place is for the name; the second is the description.*/

vector<int> numbers;
/*Key:
0:Number of Items (ex: 3 dollars)
1:Battery Life (-1 for invalid)
2:Code (-1 for invalid)*/

//Accessor
flag getUsable() { return usable; }
private:
flag usable;
};


class Interact
{
public:

Interact();

/*The following variables are made public so that the findItem and findInteract
functions can work faster, by not requiring a "get" function to be called multiple
times in a loop.*/
vector<string> settings;
/*In the above vector, the first place is for the name; the second is the description.*/

vector<flag> flags;
/*Key:
0:On/Off
1:Locked/Unlocked
2:Open/Closed
3:Usable/Unusable (ex: a chair breaks. It can no longer be used.)*/
};

Obviously, I'm not done with this yet. Player and Inventory needs to be written, and implementations for each. Then, I need to design a command-parser (I'll probably want help with that one), and of course the actual story and game.Okay, I've modified portions of the code, and added more. The only changes to existing code is that I've added a "result" enum, and changed the return type of the "findItem" type functions. I've also added code for the Player class and the Inventory class, which has been assimilated into part of Player.

rooms.hpp
Code: [Select]/*Program Name: Escape
Program Type: Command-line game
Description: Explore my old house, collect items and use them to formulate a plan to escape.
Program began: 11/17/2007
Program Ended: ??/??/????
*/

/*Brainstorming process

Will need "Room" objects, "Item" objects (for things that can be put into inventory), and
"Interact" objects that can be interacted with, but not put into inventory.

Room objects will need a String "name" that describes the room's purpose, e.g. "Family Room". They
should also have String "descriptions", which can be accessed by entering a "look around" command.

Item objects will need a "name", like Rooms, e.g. "Pencil". They should also have a description,
in case the player chooses to view a description. Some will need other properties, such as battery
life.

Interacts will need a "name". They should have descriptions. They will also need other properties,
depending on the object. These will be stored in vectors, i.e. a "boolean" vector for needed BOOLS,
"int" vector, "String", etc.

A Player class is needed. It should have room location as a variable, and an Inventory class as a
aggregated class. The Inventory class will be a vector, with references to Items as they are placed
in Inventory.

***A parser is needed in another header file*/

#include <vector>
using namespace std;
class Item;
class Interact;
enum flag { TRUE, FALSE, INVALID };
enum result { SUCCESS, FAILURE, ERROR }

class Room
{
public:
/*At initial setup, vectors should be created with all needed objects, and
passed to the Room constructor.*/
Room(String name, vector<Item> itemCreate, vector<Interact> intCreate);
//Use Default destructor; not using the Free Store.

//Accessor functions
vector<Item> getItems() { return itsItems; } //Returns entire vector
result findItem(string name); //Searches Items for certain names of Items

vector<Interact> getInteracts() { return itsInteracts; } //Returns entire vector
result findInteract(string name); //Searches Interacts for certain names

string getLocation() { return location; }

void describeRoom();
//Describe the room based on a description and items visible in the room.

private:
vector<Item> itsItems;
vector<Interact> itsInteracts;
string defaultDesc; //The default description of the room; doesn't mention items.
string location;
};

Room::Room(String name, vector<item> itemCreate, vector<Interact> intCreate)
{
/*In this portion of the code block, add code to parse a text file and
read in the desription in, adding it to defaultDesc*/
location = name;

for(int i = 0; i <= itemCreate.size(); i++)
{
itsItems.push_back(itemCreate[i]);
}

for(i = 0; i <= intCreate.size(); i++)
{
itsInteracts.push_back(intCreate[i]);
}
}

Room::findItem(string name) //For "take item" type commands.
//Similar function for Inventory class should be used.
{
/*Search the vector array of Items for one with a particular name. Return SUCCESS if
it can be found, and FAILURE if it can't be found.*/

for(int i = 0; i <= itsItems.size(); i++)
{
if(itsItems[i].settings[0] == name)
return SUCCESS;
}
return FAILURE;
}

Room::findInteract(string name) //For "use item" type commands for within a room.
{
/*Search the vector array of Interacts for one with a particular name. Return SUCCESS if
it can be found, and FAILURE if it can't be found.*/

for(int i = 0; i <= itsInteracts.size(); i++)
{
if(itsInteracts[i].settings[0] == name)
return SUCCESS;
}
return FAILURE;
}


class Item
{
public:
Item();
/*The following variables are made public so that the findItem and findInteract
functions can work faster, by not requiring a "get" function to be called multiple
times in a loop.*/

vector<string> settings;
/*In the above vector, the first place is for the name; the second is the description.*/

vector<int> numbers;
/*Key:
0:Number of Items (ex: 3 dollars)
1:Battery Life (-1 for invalid)
2:Code (-1 for invalid)*/

//Accessor
flag getUsable() { return usable; }
private:
flag usable;
};


class Interact
{
public:

Interact();

/*The following variables are made public so that the findItem and findInteract
functions can work faster, by not requiring a "get" function to be called multiple
times in a loop.*/
vector<string> settings;
/*In the above vector, the first place is for the name; the second is the description.*/

vector<flag> flags;
/*Key:
0:On/Off
1:Locked/Unlocked
2:Open/Closed
3:Usable/Unusable (ex: a chair breaks. It can no longer be used.)*/
};

class Player
{
/*As of 11/18/2007, the concept of a Inventory class is suspended. A vector of Items, with
refrences as the elements in the vector, will be used; it is more direct.*/
public:

//Accessor
string getRoom() { return curr_room; }
vector<Item> getInventory() { return inventory; } //Accessor
result findInventory(Item match); //Searches Inventory for an item that matches.
result findInventory(Item match, Item second); //For when two items are required.
//Used to check if the player has a needed Item in inventory.
private:

string curr_room; //The player's location.
vector<Item> inventory; //REFERENCES ONLY!
};

Player::findInventory(Item match)
{
/*Check each item in the Inventory vector for the Item specified. If it finds it, return
SUCCESS; otherwise, FAILURE.*/

for(int i = 0; i <= inventory.size(); i++)
{
if(inventory[i]==match)
return SUCCESS;
}
return FAILURE; //Couldn't find a match in the loop.
}

Player::findInventory(Item match, Item second) //Need two Items to return SUCCESS.
{
bool first_match_found = false; //Set true if the first loop is a success.

for(int i = 0; i <=inventory.size(); i++) //Look for the first item.
{
if(inventory[i]==match)
{
first_match_found = true;
break;
}
}
if(first_match_found==true) //Found first item, look for second.
{
for(i = 0; i <= inventory.size(); i++
{
if(inventory[i]==second)
{
return SUCCESS; //Found both items
}
}
}
return FAILURE; //Either no items can be found, or only one prerequisite is present.
}

I'm sure that there are errors that I need to correct, but the meat of this header is finished, I believe. I'm currently writing parse.hpp, which will be considerably longer. Please, if you are a programmer, point out flaws in my code, or things I can improve. It only makes me a better programmer, and causes less headaches later, at Compile Time. Okay, I've hit a brick wall. I just realized that I have no idea, at this point, where to write the code that actually does things within the game. I need to be able to write functions that can modify the state of certain Items, only allow such action if they are in the correct location (and possibly have prerequisite items, and/or have certain Interacts at appropriate settings).

For example, the Unlock Door command should set the current room's Door Item to unlocked, if and only if they are in the proper room, have a key, and have a light on so they can see what they're doing.

I'm royally stuck. Here's parse.hpp so far; it's not much code yet.

Code: [Select]// *****************PARSE.HPP*****************

/*This file is to be a header including a command parser. It will also include a text-file parser,
so that default descriptions can be read into the game, as can action text. (This makes it easier
to edit story text, even as the program is running, and keeps the .cpp file a lot less cluttered.*/

/*Brainstorming process:

***COMMAND PARSER***

A seperate parser for each room would prove useful, as it allows commands to be performed in one room
and not the other. Also, it's better organization. Finally, if I use seperate instances of a Parser
class, then I can use multiple text files, one for each room. Doing that makes less of a headache
when building the Text Parser in all its glory.

I need some flexibility in what is considered a valid command. I think it would be prudent to make
a list of possible actions, and what commands can be used to invoke them. Care must be taken not to
make duplicate commands in multiple actions, though.

Actions:
Look Around: Look, Look Around, Examine Room, Look Room
Take Item: Take x, Grab x
Examine Item (Inventory): Inventory x
Use Item: Use x on y, Use x with y, Use x y, Use x
Open/Close Interacts: (Open | close) x
Turn on/off Interacts: Turn x (on | off), Turn (on | off) x
Lock/Unlock Interacts: (Lock | Unlock) x, (Lock | Unlock) x with y
Enter Codes: Enter Code, Use Keypad, Enter numbers
Examine Interact: Look x, Look at x, Examine x
Leave Room: Go to [room], Go [room], Enter [room]

These commands will be in a text file, one for each room (ex: familyRoom.txt contains info for a
"Take Chair" command. All commands should be converted to lowercase first, and all commands listed in
the text file should also be lowercase.

***TEXT PARSER***

This should be in the same text file as the commands. They will be story-related flavor text, such as
"You pick up the [item] and put it in your inventory." They will also be room descriptions, i.e.
"The living room is rather plainly decorated, and has little to interest you. However, there is a..."
Also, action-related story text should go here, such as "The lights in the room go out. It is very
dark now, and difficult to see."

There should be optional Tutorial Text, such as, "to use your flashlight, type 'Turn on Flashlight'.",
or "You have obtained a four-digit code. This can be used to unlock a door with a electronic lock
somewhere in the house." This can be turned on or off before the game starts.

Basically, this all comes down to file streaming, and making use of re-writing a similar text
parser I wrote a while ago.
*/
#include "rooms.hpp"
#include <iostream>
#include <fstream>
enum match { FOUND, MISSING, ERROR }
class Parser
{
public:

result parseStory(string startTag, string endTag); // Finds and reads in story text.

private:
string filename; //What text file will the commands be read in from?
};I decided to go back and test some of my current functions. I am happy to report that the following code has been tested to work as expected:

Code: [Select]class Item
{
public:
Item(string name, string desc, int num, int batt, int code);
/*The following variables are made public so that the findItem and findInteract
functions can work faster, by not requiring a "get" function to be called multiple
times in a loop.*/

vector<string> settings;
/*In the above vector, the first place is for the name; the second is the description.*/

vector<int> numbers;
/*Key:
0:Number of Items (ex: 3 dollars)
1:Battery Life (-1 for invalid)
2:Code (-1 for invalid)*/

//Accessor
flag getUsable() { return usable; }
private:
flag usable;
};

Item::Item(string name, string desc, int num, int batt, int code)
{
settings.push_back(name);
settings.push_back(desc);
numbers.push_back(num);
numbers.push_back(batt);
numbers.push_back(code);
}


class Interact
{
public:

Interact(string name, string desc, flag on, flag lock, flag open, flag usable);

/*The following variables are made public so that the findItem and findInteract
functions can work faster, by not requiring a "get" function to be called multiple
times in a loop.*/
vector<string> settings;
/*In the above vector, the first place is for the name; the second is the description.*/

vector<flag> flags;
/*Key:
0:On/Off
1:Locked/Unlocked
2:Open/Closed
3:Usable/Unusable (ex: a chair breaks. It can no longer be used.)*/
};

Interact::Interact(string name, string desc, flag on, flag lock, flag open, flag usable)
{
settings.push_back(name);
settings.push_back(desc);
flags.push_back(on);
flags.push_back(lock);
flags.push_back(open);
flags.push_back(usable);
}

class Room
{
public:
/*At initial setup, vectors should be created with all needed objects, and
passed to the Room constructor.*/
Room(string name, vector<Item> itemCreate, vector<Interact> intCreate);
//Use Default destructor; not using the Free Store.

//Accessor functions
vector<Item> getItems() { return itsItems; } //Returns entire vector
result findItem(string name); //Searches Items for certain names of Items

vector<Interact> getInteracts() { return itsInteracts; } //Returns entire vector
result findInteract(string name); //Searches Interacts for certain names

string getLocation() { return location; }

private:
vector<Item> itsItems;
vector<Interact> itsInteracts;
string defaultDesc; //The default description of the room; doesn't mention items.
string location;
};

Room::Room(string name, vector<Item> itemCreate, vector<Interact> intCreate)
{
/*In this portion of the code block, add code to parse a text file and
read in the desription in, adding it to defaultDesc*/
location = name;

for(int i = 0; i < itemCreate.size(); i++)
{
itsItems.push_back(itemCreate[i]);
}

for(int i = 0; i < intCreate.size(); i++)
{
itsInteracts.push_back(intCreate[i]);
}
}

result Room::findItem(string name) //For "take item" type commands.
//Similar function for Inventory class should be used.
{
/*Search the vector array of Items for one with a particular name. Return SUCCESS if
it can be found, and FAILURE if it can't be found.*/

for(int i = 0; i <= itsItems.size(); i++)
{
if(itsItems[i].settings[0] == name)
return SUCCESS;
}
return FAILURE;
}

result Room::findInteract(string name) //For "use item" type commands for within a room.
{
/*Search the vector array of Interacts for one with a particular name. Return SUCCESS if
it can be found, and FAILURE if it can't be found.*/

for(int i = 0; i <= itsInteracts.size(); i++)
{
if(itsInteracts[i].settings[0] == name)
return SUCCESS;
}
return FAILURE;
}Sheesh, this thread is dead. Either way, I'll KEEP posting this, so people can step in if they wish to correct something, or if they know a better way of doing something.

Anyway, all of rooms.hpp has been tested, and works flawlessly. I had to change/add a few things, though.

Code: [Select]// *****************ROOMS.HPP*****************

/*Program Name: Escape
Program Type: Command-line game
Description: Explore my old house, collect items and use them to formulate a plan to escape.
Program began: 11/17/2007
Program Ended: ??/??/????
*/

/*Brainstorming process

Will need "Room" objects, "Item" objects (for things that can be put into inventory), and
"Interact" objects that can be interacted with, but not put into inventory.

Room objects will need a String "name" that describes the room's purpose, e.g. "Family Room". They
should also have String "descriptions", which can be accessed by entering a "look around" command.

Item objects will need a "name", like Rooms, e.g. "Pencil". They should also have a description,
in case the player chooses to view a description. Some will need other properties, such as battery
life.

Interacts will need a "name". They should have descriptions. They will also need other properties,
depending on the object. These will be stored in vectors, i.e. a "boolean" vector for needed BOOLS,
"int" vector, "String", etc.

A Player class is needed. It should have room location as a variable, and an Inventory class as a
aggregated class. The Inventory class will be a vector, with references to Items as they are placed
in Inventory.

***A parser is needed in another header file*/

#include <vector>
#include <string>
using namespace std;
enum flag { TRUE, FALSE, INVALID };
enum result { SUCCESS, FAILURE, ERROR };

class Item
{
public:
Item(string name, string desc, int num, int batt, int code);
/*The following variables are made public so that the findItem and findInteract
functions can work faster, by not requiring a "get" function to be called multiple
times in a loop.*/

vector<string> settings;
/*In the above vector, the first place is for the name; the second is the description.*/

vector<int> numbers;
/*Key:
0:Number of Items (ex: 3 dollars)
1:Battery Life (-1 for invalid)
2:Code (-1 for invalid)*/

//Accessor
flag getUsable() { return usable; }

//For Comparison purposes
bool operator==(Item rhs);
private:
flag usable;
};

Item::Item(string name, string desc, int num, int batt, int code)
{
settings.push_back(name);
settings.push_back(desc);
numbers.push_back(num);
numbers.push_back(batt);
numbers.push_back(code);
}

bool Item::operator==(Item rhs)
{
for(int i = 0; i < numbers.size(); i++)
{
if(numbers[i] != rhs.numbers[i])
return false;
}
for(int i = 0; i < settings.size(); i++)
{
if(settings[i] != rhs.settings[i])
return false;
}
if(getUsable() != rhs.getUsable())
return false;
return true; //All checks are made, we're clear.
}


class Interact
{
public:

Interact(string name, string desc, flag on, flag lock, flag open, flag usable);

/*The following variables are made public so that the findItem and findInteract
functions can work faster, by not requiring a "get" function to be called multiple
times in a loop.*/
vector<string> settings;
/*In the above vector, the first place is for the name; the second is the description.*/

vector<flag> flags;
/*Key:
0:On/Off
1:Locked/Unlocked
2:Open/Closed
3:Usable/Unusable (ex: a chair breaks. It can no longer be used.)*/
};

Interact::Interact(string name, string desc, flag on, flag lock, flag open, flag usable)
{
settings.push_back(name);
settings.push_back(desc);
flags.push_back(on);
flags.push_back(lock);
flags.push_back(open);
flags.push_back(usable);
}

class Room
{
public:
/*At initial setup, vectors should be created with all needed objects, and
passed to the Room constructor.*/
Room(string name, vector<Item> itemCreate, vector<Interact> intCreate);
//Use Default destructor; not using the Free Store.

//Accessor functions
vector<Item> getItems() { return itsItems; } //Returns entire vector
result findItem(string name); //Searches Items for certain names of Items

vector<Interact> getInteracts() { return itsInteracts; } //Returns entire vector
result findInteract(string name); //Searches Interacts for certain names

string getLocation() { return location; }

private:
vector<Item> itsItems;
vector<Interact> itsInteracts;
string defaultDesc; //The default description of the room; doesn't mention items.
string location;
};

Room::Room(string name, vector<Item> itemCreate, vector<Interact> intCreate)
{
/*In this portion of the code block, add code to parse a text file and
read in the desription in, adding it to defaultDesc*/
location = name;

for(int i = 0; i < itemCreate.size(); i++)
{
itsItems.push_back(itemCreate[i]);
}

for(int i = 0; i < intCreate.size(); i++)
{
itsInteracts.push_back(intCreate[i]);
}
}

result Room::findItem(string name) //For "take item" type commands.
//Similar function for Inventory class should be used.
{
/*Search the vector array of Items for one with a particular name. Return SUCCESS if
it can be found, and FAILURE if it can't be found.*/

for(int i = 0; i <= itsItems.size(); i++)
{
if(itsItems[i].settings[0] == name)
return SUCCESS;
}
return FAILURE;
}

result Room::findInteract(string name) //For "use item" type commands for within a room.
{
/*Search the vector array of Interacts for one with a particular name. Return SUCCESS if
it can be found, and FAILURE if it can't be found.*/

for(int i = 0; i <= itsInteracts.size(); i++)
{
if(itsInteracts[i].settings[0] == name)
return SUCCESS;
}
return FAILURE;
}




class Player
{
/*As of 11/18/2007, the concept of a Inventory class is suspended. A vector of Items, with
refrences as the elements in the vector, will be used; it is more direct.*/
public:


Player(string room);
//Accessor
string getRoom() { return curr_room; }
Item getInventory(int i) { return inventory.at(i); } //Accessor

result findInventory(Item match); //Searches Inventory for an item that matches.
result findInventory(Item match, Item second); //For when two items are required.
//Used to check if the player has a needed Item in inventory.
vector<Item> inventory; //REFERENCES ONLY!
//Action functions
void takeItem(string command);
void useItem(string command);
void inventoryItem(string command);
void lookAround();
void lockInteract(string command);
void activateInteract(string command);
void enterCode(string command);
void examineInteract(string command);
void goToRoom(string command);
private:

string curr_room; //The player's location.

};

Player::Player(string room)
{
curr_room = room;
}

result Player::findInventory(Item match)
{
/*Check each item in the Inventory vector for the Item specified. If it finds it, return
SUCCESS; otherwise, FAILURE*/

for(int i = 0; i < inventory.size(); i++)
{
if(getInventory(i)==match)
return SUCCESS;
}
return FAILURE; //Couldn't find a match in the loop.
}

result Player::findInventory(Item match, Item second) //Need two Items to return SUCCESS.
{
bool first_match_found = false; //Set true if the first loop is a success.

for(int i = 0; i <inventory.size(); i++) //Look for the first item.
{
if(getInventory(i)==match)
{
first_match_found = true;
break;
}
}
if(first_match_found==true) //Found first item, look for second.
{
for(int i = 0; i < inventory.size(); i++)
{
if(getInventory(i)==second)
{
return SUCCESS; //Found both items
}
}
}
return FAILURE; //Either no items can be found, or only one prerequisite is present.
}

This is just a header file, too. Time to write the parser.Did you notice those "Action Commands" that were given PROTOTYPES, but not actually written, in the above code? As it happens, they are part of the command parser, which deals with user input from the command-line. As it happens, this is the bulk of the coding left to do. After that, I need to write the story parser, and create the text files for the story (which will be read in by the Story Parser), i.e. "you take the [object]." or "the room you are in is ...".

Anyway, writing these action commands has forced me to come to grips with a powerful aspect of C++ that I didn't ever quite learn perfectly: The pointer. References won't do here, as the pointer needs to not be constant. I have changed the Player member variable "string curr_room" to "Room *itsRoom", so that I can use the current Room in logic, such as the takeItem method I just finished:

Code: [Select]void Player::takeItem(string command)
{
/*Get the Item to be taken into a string variable, then check against current room's Items.
If the item can be found, make sure it's not already in the player's inventory.*/
string theItem = command.substr(5); //Discount the "Take "
bool itemExists = false;
for(int i = 0; i < itsRoom->getItems().size(); i++)
{
if(itsRoom->getItems()[i].settings[0] == theItem)//The item exists in the room
{
itemExists = true;
if(findInventory(itsRoom->getItems()[0]) != SUCCESS) //If he doesn't have it already
{
Item & newInventoryItem = itsRoom->getItems()[i];
inventory.push_back(newInventoryItem);
//Code to parse the story here.
break;
}
else //He already has the item
{
cout << "You already have this item in inventory.\n";
}
}

}

if(!itemExists)
{
cout << "No such item exists.\n";
}
}
I'm slowly making my way through this, but it will take some time to complete the command parser. Once I have, and once it's all checked for errors, I will be considerably happier about this project, as this is the wall that stopped me twice in a row, now. Not this time, though.

2117.

Solve : Error Trapping Sample Code?

Answer»

Hello,

Another APPROACH to my ERROR issue might be to see some sample error TRAPPING code. If ANYBODY is willing to post some sample code that might be able to HELP me figure out what I need to do. Though, the could would need to be in dBASE 5.0 for DOS.

Thanks

2118.

Solve : Batch file puzzle?

Answer»

Trying to make a BATCH file, TAKE a file named 'LABEL-O.LUA' and rename it 'LABEL.LUA'
... that is the easy part....
THEN I WANT to copy or move that RENAMED file to another folder.... OR... !!!

BACKGROUND~
Have two files. Let's call them 'Label-1' and 'label-2'... [lua]
These two files have variances inside, reversed.
example:
........one says YES
the other says NO
That is OK and what i want.

so far so good....

I want to be able to TOGGLE either [renamed] file to another folder ... [the ORIGINAL filename LABEL.LUA] so the program they are inside of... can use either file but both files must able to be RENAMED LABEL.LUA while the other remains NOT renamed.

I know what I want yet even my explanation here is confusing to me...and I wrote it !!!

Two batch files are OK too if it cannot be done with one TOGGLING batch file.

My insanity stems from trying to emulate a batch file that in part, has a series of 'WAV' files that it RENAMES to '*.WA_ ' so that the program does not recognize them and therefore uses other sound files [*.ogg]
Running this batch file AGAIN and it REVERSES the process and takes the '*.WA_' files and renames them '*.WAV' so the program now recognizes these and uses them therefore NOT USING the '*.ogg' files.

going nuts....

Sam
quote:
"My insanity stems from trying to emulate a batch file that in part, has a series of 'WAV' files [40] that it RENAMES to '*.WA_ ' so that the program does not recognize them and therefore uses [40] other sound files [*.ogg]
Running this batch file AGAIN and it REVERSES the process and takes the '*.WA_' files and renames them '*.WAV' so the program now recognizes these and uses them therefore NOT USING the '*.ogg' files."
....................................... ...

I see many have had a looksee but no responses.
Probably my fault.

Here is the BATCH FILE I referred to that RENAMES files then RENAMES them back again.
This is something like I want to do and tried to explain to you.



SWITCHER.BAT
~~~~~~~~~~~~~~~
@echo off
CLS
echo Please wait....
if exist *.wav goto rename_to_wa_
if exist *.wa_ goto rename_to_wav
echo no *.WAV or *.WA_ files found
pause
goto stop
REM --------
:rename_to_wa_
ren *.wav *.wa_
CLS
echo original voice selected
goto end
REM --------
:rename_to_wav
ren *.wa_ *.wav
CLS
echo alternative voice selected
REM --------
:end
echo _
pause
:stop
~~~~~~~~~~~~~~~~~~

As stated in my first post.
I took THIS batch file as my inspiriation to rename two almost identical files
call them
Label-1.lua .... this one says YES
Label-2.lua .... this one says NO

In order for them to work they EACH must END UP with the name LABEL.LUA
Naturally only one file can be in the folder at a time with the EXACT same name. Soooo I want to be able to TOGGLE them [like the SWITCHER.BAT file] shown above.

OR.... be able to EXchange the LABEL-1 file for the LABEL-2 file.... with either a toggle or via two different batch files.

Hopefully this is a bit clearer.
SamI have only a vague idea of what you are trying to do. That may point to a key part of the problem: You acknowledge that your explanation is not very clear. I find that when I can express my problem well in English, then I can CODE it easily, and vice versa.

Ennyhow -- perhaps you need an overlay rather than a rename. Say you have two files SOURCE1 and SOURCE2. You can COPY SOURCE1 to SOURCERY, then later overlay it with COPY SOURCE2 SOURCERY.

That would not work with your .WAV files, but what about the others (which I can't see right now. Does that HELP?

2119.

Solve : dDBASE 5.0 for DOS - file lock info?

Answer»

Hi All,

I am USING dDBASE 5.0 for DOS.

I have a FILE locked and I am trying to get the information on who locked it. So far, I have tried using LKSYS() (ALREADY CONVERTed the tables) and it only works if I issue the COMMAND with the same user that has the file locked. Given that information, I could check a database for lock information, then lock the file and have the user report their information DBF(), ID(), TIME() and DATE() to a database file to be read by other users.

Is there a better way to get the lock information?

Thanks

2120.

Solve : Make a .bat save everything in the window to a .txt??

Answer»

Well, I have made a .bat file that gives you options.

The problem is that I cant figure out how to save everything the program writes to a txt.
I already have it SAVING the time and renaming the file and such, as far as ive understood it should be after the .exe in the CODE.

Code: [Select]ECHO @prompt set date=$d$_set time=$t$h$h$h &GT; {a}.bat
%comspec% /e:2048 /c {a}.bat > {b}.bat
FOR %%v in ({b}.bat del) do call %%v {?}.bat
ECHO %date% %time% >> logonserverlog.txt
ECHO Logging logonserver
START /B /WAIT logonserver.exe
ECHO @prompt set date=$d$_set time=$t$h$h$h > {a}.bat
%comspec% /e:2048 /c {a}.bat > {b}.bat
FOR %%v in ({b}.bat del) do call %%v {?}.bat
ECHO %date% %time% >> logonserverlog.txt
FOR /F "tokens=1-5 delims=:" %%d in ("%time%") DO rename "logonserverlog.txt" %%d-%%e.txt
GOTO START
This is part of the code. What this is going to do (you probably understand just by looking) is make a file called logonserverlog.txt, save the date, and time and then whenever it shuts down or crashes (most likely crashes) then it will save the time there as well. It also renames the file to the time it stopped.

I also have an option of MAKING it LOOP the start, so it automatically starts when it crashes.
Guessing that the command for exporting the text to the .txt has to be after the START.
Every comment is welcome.Wow! I haven't seen a date/time extraction routine like yours since DOS days. But hey, if it worked then, it should work now.

Have you tried simply redirecting the output of logonserver.exe to your log file?

Code: [Select]START /B /WAIT logonserver.exe >> logonserverlog.txt

If you don't need all the output in your log file, you might be able to split out the STDOUT and the STDERROR data streams.

Just a thought.
using Code: [Select]START /B /WAIT logonserver.exe >>logonserverlog.txt was the first thing I tried. However that caused everything to stop and not work.

However, after some messing around I managed to get it working.

Code: [Select]START /B /WAIT logonserver.exe>logonserverlog.txt
that almost made me cry thinking of all the time spent figuring that out.
But thanks alot for your response ^_^ might pick up php or autoit again

2121.

Solve : Keylogger (?) used for good purpose?

Answer»

Hey, I'm trying to build my own screen capture program in VB2008 (codename:Orcas) and I basically have no idea how to start.

What I need the program to do is run in the background using very little memory and intercept every keypress (without causing a delay) or just the PRT SCR key. When the PRT SCR key is pressed, it takes what's in the clipboard, saves it as pic00000x.jpg and then increments x by 1.

I had the idea to essentially build a keylogger and then just remove all the checks except for the PRT SCR key, but I'm still stumped.

I'm trying to do this so I can capture screens out of games without constantly swapping between the game and Photoshop, while still reserving system memory and CPU power. For example, I was trying to capture screens from Crysis, but it required pausing and saving a new jpg every time I wanted to capture a screen.

Any IDEAS?


P.S.
Since I just laid out basically how to write the entire program, here's my actual PROBLEM:
A) I don't know the CODE to make it run in the background
B) I don't know the code to intercept keystrokes
C) I don't know how to make it not delay my keystrokes
D) I don't know the numeric code for the PRT SCR button
E) I don't know how to SAVE the clipboard to a .jpg through VB

etc. etc.

Thanks
-Rockrockerest,

As you might GUESS, being too specific about keylogging programs can be hazardous to everyone's well-being.

A) One method would be to create program as a windows application and delete the form. Easier would be to create program as a DLL.

B) Iterate thru a System.Windows.Forms.Keys enumeration checking for pressed keys. The User32.dll should very helpful.

C) Not sure this applies. The keylogger will run asynchronously to your game.

D) PRTSCRN is a function key. My guess is that the system hooks this key; your appplication may never see a keypress event.

E) To save the clipboard as a jpg file, use the VB Help and look for My.Computer.Clipboard.GetImage

Disclaimer: Installing a keylogger program on a computer not your own is illegal.








2122.

Solve : C++ question?

Answer»

k , was reading a beginners guide to c++

#include <iostream.h> // file that includes
// INFO on input and ouput

main() //aways 1st function in c++ console apps[mandatory]
{
cout<<"Hey Bevis this is cooool";

return 0;

}


i took this code and saved it as cpp.cpl , then i opend it and it opened itself a couple hundred times what did i do wrong?CPL extensions are associated with the Windows Control Panel. Could you not use an actual program name with a CPP extension?

Couple things:

1. You need to name it as NAME.cpp, not cpp.cpl. It's the cpp file that is compiled into an EXE.

2. Your code will not compile. You need to change this line:

main ()

to this:

int main ()

3. ALSO, after the #include line, before the int main(), you need to do this:

USING namespace std;

So, it should look like this:

Code: [Select]#include <iostream> // file that includes
// info on input and ouput

using namespace std; //Allows use of cout, cin and other commands

int main() //aways 1st function in c++ console apps[mandatory]
{
cout << "Hey Bevis this is cooool";

return 0;

}
Save that as SOMETHING.cpp, replacing "something" with whatever name you want.

Cheers,
Dilbert

EDIT: Note that I used #include , not #include . iostream.h is an old file, used primarily these DAYS for C, not C++. With a simple program like this, you won't notice a difference, but when you get into Objects, the difference will be much more apparent.

2123.

Solve : C++ Dos 2d Games?

Answer»

Does anyone know any SITES that focus only on DOS Games.

Or that explain certain WORDS LIKE:
outtextxy
settextstyle
bar
setcolor

2124.

Solve : Calculating Dates in an Access database?

Answer»

I'm looking for a formula, expression or event procedure that will allow me to calculate a future date based on a given number of weeks. (The USER will SELECT the start date and the desired number of weeks). The weeks must be Monday through Friday only and exclude certain HOLIDAYS that will be entered in the database.

Can someone help?Sometimes it's better to plow through this one step at a time. VBA has date handling functions which can be useful. The DateAdd function allows you to add weeks to a given date resulting in a date.

When you have a start date and a date a given number of weeks from the start date, you can iterate thru your holiday database and check if any holiday falls between the start date and the end date (inclusive). If so, add 1 to the end date (DateAdd again).

Once you finished checking the holidays, you can use the WeekDay function to determine if the end date is a weekend. If so, you can DateAdd either 1 or 2 to the end date to push it into the next week. Presumably, if the end date falls on a Saturday or a Sunday you WANT to push the result to Monday.

Good luck! In response to the reply from Sidewinder:

The following is code I found that I've used in an Access database to calculate a future date from a specified starting date. The code is attached to an on-click event procedure of a command button.
The user selects a date from a calendar control, clicks on the command button and is then asked how many days from the starting date the future date should be. The result is given after the user clicks OK. (The code can also be used for weeks or months with some small modifications.)

Private Sub Command 18_Click()
Dim FirstDate As Date 'Declare variables
Dim IntervalType As String
Dim Number As Integer
Dim Msg
IntervalType = "d" '"d" specifies days as interval
FirstDate = Calendar1
Number = InputBox ("Enter number of days to add")
Msg = "NEW date: " & DateAdd(IntervalType, Number,FirstDate)
MsgBox Msg
Exit_Command18_Click
End Sub

The question is: how do I adapt, modify or change the code so that weekends and specified holidays are excluded in the calculation? I'm new at this so I need all the help I can get. Thanks.
You're on the right track. Instead of producing a MsgBox literal with the future date, compute a Calendar2 date from the expression DateAdd(IntervalType, Number,FirstDate).

Where are the holidays? If they are in a database, you can select all the records, create a recordset and loop thru each one. If the holiday is greater than or equal to the Calendar1 date AND less than or equal to the Calendar2 date, use the DateAdd function to add 1 to the Calendar2 date, effectively skipping the holiday.

For the final calculation, use the WeekDay function to determine if Calendar2 falls on a weekend. If Saturday add 2 or if Sunday add 1 with the DateAdd function to push the Calendar2 date to a weekday (Monday).



PS. VBA (or any language for that matter) knows nothing about the real word and does not understand the concept of holidays or weekends. If you need to completely eliminate weekend dates from your calculations, it gets more complicated.

2125.

Solve : need some help basic .bat scripting?

Answer»

OK so i was wondering if i could get some help,, this SITE has been very resourceful,, i have a program that i use very frequently for data entry and preform the same task about 80% of the time,, the system i use is xp based,, what i would like to do is get a script that can select the program bring it to the front and preform predetermined actions BASICALLY a macro. i have built a GUI thru vb that i can link the scripts to anyone have anything they can THROW my way?

the keys strokes in order in example would be F5, a, up, tab, n 5x, tab, enter

Script56.chm should be installed on your machine. It's the compiled help FILE for VBScript. Check out the sendkeys method of the Shell object. You should be able to write a VBScript to HANDLE this chore.

Good luck

Note: VBScript has been installed with Windows since Win95C. If you cannot find the help file you can download it here

2126.

Solve : long long problem?

Answer»

This program works in linux but not in windows:

#include<cstdio>
int main(){
long long a=1234567;
long long B=7654321;
long long c=a*b;
printf("%lld\n",c);
return 0;
}

what's the problem?Instead of:

Code: [Select]#include<cstdio>
Try:

Code: [Select]#include <cstdio.h>
And I'm not sure if it will make any difference, but instead of:

Code: [Select]int main(){
Try this instead:

Code: [Select]int main()
{HII,
I THINK the following code works.
worked for me, so you check out:

#include
int main(){
long long a=14354;
long long b=5323;
long long c=a*b;
printf("%lld\n",c);
getch();
return 0;
}

I dont think there is any header file in c with the name "cstdio".
Also if you want to view result you MUST add getch() to yuor program.

#include

int main()
{
long long a=1234567;
long long b=7654321;
long long c=a*b;
printf("%lld\n",c);

getchar();
return 0;
}

2127.

Solve : NEED ANY FROM THAT!!?

Answer»

Hello
I NEED this compiler (PERSONAL COBOL) for Windows VISTA, and these programs (Visio 2003 or any version, PhotoShop & FrontPage 2003 or any version). Thanks to read my topic. I hope that you reply on my question.Welcome to the CH forums.

Are you asking for DETAILS on how to download the items for free?? I understand that Visio, Photocopy and Frontpage are copyrighted, it would therefore be against forum rules to ADVISE you.

Good luckHello,

Although it is illegal to give you these for free, you can download these free alternatives:

COBOL Compilers
http://www.thefreecountry.com/compilers/cobol.shtml

Visio Alternative - DIA
http://live.gnome.org/Dia

Photoshop Alternative - Gimp
www.gimp.org/windows/

FrontPage Alternative - NVU
http://www.nvu.com/

2128.

Solve : GFHG?

Answer»

U CAN HELP MEwhat's the problem?More spam.Where's that DARN Obi-Wan when you NEED him?

2129.

Solve : Compilers?

Answer»

Today we can just use a compiler to make programs and you can even program your own compiler. So how was the first compiler made? It's like, which came first the chicken or the egg.No one came first.
Neither the egg, nor the chicken. The first living species on this EARTH was blue green ALGAE, which were single celled organisms. They took birth due to the various natural CHEMICAL reactions. Then GRADUALLY, as the earth's atmosphere changed, new and diverse species were generated. That is how the current day living organisms were created( by mutation of the ancient species). Got it.

Now,enough of biology, let's come back to compiler.
Well, as far as I know, When the computers were originally created, They were hard wired devices, and coding was done in machine language (0 and 1).
Then assemblers were generated, which converted the assembly language(more understandable Than m/c language).
Now, gradually with time translators were generated as the new languages were developed. As the NEEDS of different languages were different, The structure of compiler changed( Mutation took place ).
Earlier the compilers used to convert the codes written by the user into machine code. now a days some compilers use the concept virtual computers.
Also in today's time compilers like YACC (yet another compiler compiler) have been generated, Which enable the users to make their own compiler.

Oho I have almost written an assay, Did it help? Yes, it helped. Thanks for everything.

So compilers were originally hardware, and then someone used a hardware compiler to make a software compiler like the one's we use today?I think so.

2130.

Solve : XSLT/WORDML compatibility issue between Office 2007 and Office 2003?

Answer»

I've written several XSLT files that take xml from a web service and translates it into a Microsoft Word 2003 Document using WordML. The problem I'm having is with the headers and footers. They seem to be switching from landscape to portrait constantly when the document is viewed in office 2003, but if viewed in office 2007 it looks just fine, APART from them all appearing as portrait header/footers.

I use modular xslt files to create the word document, each section in the document is pulled through a different xslt file to make reusability much easier. The headers and footers are also inherited from a different xslt file and not HARD coded into each one.

I need help figuring out how to make my header/footer file work properly and how/where i would need to CALL that template into the rest of the main document.

2131.

Solve : Power-On Password (HELP!!!)?

Answer»

I have a HP Pavilion zx5040us laptop.
Recently, I have gotten a screen that says I need to enter a "power-on PASSWORD".

It happens like this:
-I turn on the power
-System starts to load
-Windows Logo screen comes up
-Then it goes to "Power-On Password" screen and sits there

I have tried typing in "Generic BIOS passwords" - don't work.
I've tried pressing the F2/F10/ESC/DEL keys that it states to press in ORDER to get to the BIOS screen - doesn't LET me, goes right to the "Power-On Password" screen.

So someone told me that I may need to TAKE out the CMOS battery or flip the switches on the motherboard. I really don't want to do anything inside the laptop until i really need to.
And if I do, is this the best way to solve the PROBLEM??

HELP!!!

2132.

Solve : Batch file programming..HELP PLEASE?

Answer»

pLEASE somebody help me..i am trying to create a batch file (DOS scripting),
IN which we can use any parameter like a file EXTENSION,date,name etc.and delete those files existing ina particular directory and delete all parameter matching files in that directory and sub FOLDER which are 100 DAYS older than the current date.
Please help me guys.My job depends on this..please .I dont know anything about batch files ..please HELP ME its very URGENT i just ahve like 15 hours

2133.

Solve : Need help with batch files scripting?

Answer»

I need to CREATE a code ,a BATCH FILE which will delete files usinf a parameter like file extension,name or date which is 100 days older than CURRENT date.please HELP..Welcome to the CH forums.

Double posting will not generate responses but information might. Please read this..

2134.

Solve : C++ Probelm "iostream"?

Answer»

Hi there,

As I'm new to C++ I could not able to solve this follwing small probelm.

#INCLUDE

int main()
{
cout << "Welcome to the wonderful world of C++!!!\n";
return 0;
}


I saved this FILE as testing.c and tired to complied and run it, but it showed twe error messages "UNABLE to open include file 'iostream'" and "undefined symbol 'cout' in function main<>"

Then I saved as testing.cpp that's also shows the same error msgs.

I'm using turbo C++ VERSION 2

It would be more appreciate if anyone give me the solution for my problemYou should write
#include
or
#include
using namespace std;


check it out. Unless you're writing backwards-compatible code, you don't need to use iostream.h. Use Tripti's second solution.Turbo C++ 2.0 is a complete FOSSIL, "namespace" wasn't even a keyword back then. You will likely need to use the #include version. You should consider updating your compiler to something more recent (if at all possible).#include

using namespace std;

int main()
{
cout << "Welcome to the wonderful world of C++!!!\n";
getchar();
}

2135.

Solve : C++ programing problem?

Answer»

#include
#include

int main()
{
int student;

{
COUT<<"pls enter the number 006006\n";
cin>>student;
cout< }
cout<
system("PAUSE");
return 0;
}
_______________________________________ ____________________________
elo guys..i have some problems regarding on the syntax above..the output that i am expecting on this program is "006006" w/out the quotes ofcors, but this doesnt show, insted the output is "6006"..this means that the integer 0 on the begining of the cin>> was not shown on the cout<<..can u pls give me the syntax needed?im very thankful in advance for UR help..this site is very helpful to newbies like me.. thanks a LOT..I dont think if you use integer, you will get 0s before the ORIGINAL no. in the result.
If you really want 0s to be displayed, then I think you can use a string.
Try it out.He's right. Leading zeros are ignored with ints. Strings work better for leading zeros, or you can add them yourself.#include
#include

using namespace std;

int main()
{
string students;
cout << "Enter AMOUNT of students: ";
getline(cin,students);

cout << "Students: " << students;
getchar();
}

2136.

Solve : Java file writing problems.?

Answer»

Hey, I'm using the book "Beginning Programming with Java for Dummies", and I was attempting to write my own little crappy game with it, I'm shooting for a RPG. And I'm having problems with writing a file a file, and would appreciate any help.

I went through and commented just about everything.

And if you see anything I should change or add or just any tips I'd appreciate it.

Errors:
Code: (text) [Select]3 errors found:
File: C:\Documents and Settings\<myname>\TextWorld\Main.java [line: 88]
Error: C:\Documents and Settings\<myname>\TextWorld\Main.java:88: illegal start of expression
File: C:\Documents and Settings\<myname>\TextWorld\Main.java [line: 88]
Error: C:\Documents and Settings\<myname>\TextWorld\Main.java:88: not a statement
File: C:\Documents and Settings\<myname>\TextWorld\Main.java [line: 88]
Error: C:\Documents and Settings\<myname>\TextWorld\Main.java:88: ';' expected

Script: (WARNING: NEW PROGRAMMER'S FIRST SCRIPT)
Code: (text) [Select]//Imports Start\\
import java.util.Scanner;//Imports Scanner
import java.io.File;//Imports File
import java.io.FileNotFoundException;//Imports a suggested thing in case file not found.
import java.io.PrintStream;//Imports Printer for files
//Imports End\\

//----------\\

//Class Start\\
class TextWorld { //Start of class TextWorld

//Main Method Start\\
public static void main(String args[]) { //Start of my main method
beginGame(); //Starts the game
}
//Main Method End\\

//----------\\

//Methods Start\\
//Start Menu Start\\
public static void beginGame(){ //The starting method called by main method
Scanner numChecker = new Scanner(System.in); //New scanner called numChecker for checking the number input.
int num; //New int for the numChecker to record in.
//Some text options.
System.out.println("Hello and welcome to TextWorld!");
System.out.println("[Options]");
System.out.println("[1]-Login if your an existing user.");
System.out.println("[2]-To create a new account.");
System.out.println("[3]-To exit TextWorld.");
System.out.println("Note 1: To choose an option type the assinged number to it.");
System.out.println("Note 2: Please refrain from typing anything that isn't a number unless told OTHERWISE.");

num = numChecker.nextInt(); //Uses the Scanner numChecker to get the next int and put it in variable num.
//Checks to see what option they chose
if (num == 1) {
login();
}
if (num == 2) {
newUser();
}
if (num == 3) {
System.out.println("Program stopped.");
}
if (num < 1 || num > 3) {
System.out.println("INVALID Command.");
beginGame();
}
}
//Start Menu End\\

//---------\\

//Character Login Start\\
public static void login() { //Note: I just setup this method before hand so don't worry about this.
Scanner nameChecker = new Scanner(System.in); //Scanner to check name
String characterName; //variable to STORE the players string and hopefully will soon check and see if it exists.

System.out.print("Name:"); //Asks for user's name of character

name = nameChecker.nextLine(); //Gets the string they type and puts it in name.

System.out.println(name); //Just a check to make sure it's reading it. Will remove later.
}
//Character Login End\\

//----------\\

//New Character Start\\
public static void newCharacter() { //This is for when they make a new character. It's supposed to record everything to a new file.
Scanner nameChecker = new Scanner(System.in); //New scanner that will check and see what name they want.
String characterName; //String variable to hold their name and compare it with used names to see if it's available. Don't actually know how to do this yet.
int characterClass = 0; //Will set the character class that they choose. I will determine class by numbers.
int statStrength = 0; //Number for their strength STAT.
int statDefense = 0; //Number for their defense stat.
int statVitality = 0; //Number for their vitality stat.
int statWisdom = 0; //Number for their wisdon stat.
//Will add in a input for their name and the nameCheck as soon as I figure it out.

}
//New Character End\\

//----------\\

//Character Name In Use Check Start\\
public static void nameCheck() { //Will check and see if a name already exists.
throws FileNotFoundException { //Book says your supposed to add this. ALL ERRORS HERE
Scanner nameScanner = new Scanner(new File("characters\\name.txt")); //The book says it's supposed to work.

System.out.println(diskScanner.fineInLine(".").charAt(0)); //I am STILL trying to figure out how to work this line.
}
}
//Character Name In Use Check End\\
//Methods End\\
}
//Class Ends\\Code: [Select]System.out.println(diskScanner.fineInLine(".").charAt(0)); //I am still trying to figure out how to work this line
Might just be a typo.
I think you want the findInLine method of Scanner, not fineInLine.

2137.

Solve : Pascal-to-C or C++ cross-compiler?

Answer»
I'm porting an application of about 15,000 lines of Pascal code to Windows CE from 3.1, and want to update the language from Borland Pascal 7.0 to MICROSOFT Visual Studio 2005 C or C++.

I have been trying to find out if there is a cross-compiler that would help me along. Does anybody know of one or have any info?

Thanks!A cross compiler is a compiler that is able to create binary code for a platform different from the one the compiler is RUNNING on. These are often used when it is unpractical to compile the code directly on the platform, for example if the platform is a slow mobile device. But in order to use a cross compiler you will still need source code that is capable of running on the platform you wish to create a binary for, which is not the CASE here.
If you want to port the code to a different language, I believe you unfortunately have to more or less rewrite the application. Have you CHECKED to see if there are any pascal compilers for WinCE? It might save you some time.I know there is some free software called p2c that can take pascal source code and make it C or C++ source for you. Might help remove some drudge work, but might also be more trouble than its worth if your Pascal PROGRAM uses a lot of libraries you don't have the source for or graphics routines. Read about/download p2c at the author's page here: http://www.synaptics.com/people/daveg/
2138.

Solve : MySQL help needed: LEFT JOIN and INNER JOIN?

Answer»

Hey GUYS,

I need help with mysql statement. I have 3 tables: new_orders, client_info, admin_notes.

I'm trying to join all three tables together but having admin_notes as an optional result - meaning it may or may not be there.

To join first two tables I used INNER JOIN, LIKE this:

Quote

SELECT * FROM new_orders INNER JOIN client_info ON new_orders.client_id = client_info.client_id

Now, I need to attached admin_notes to this result set but only some orders have notes and other's don't. I noticed you can't combine INNER JOIN with LEFT JOIN in one statement

I tried doing:

Quote
SELECT * FROM new_orders INNER JOIN client_info ON client_info.client_id = new_orders.client_id, new_orders LEFT JOIN admin_notes ON new_orders.order_id = admin_notes.order_id

But this RETURN an error saying new_orders is not unique table/alias.

Any ideas how to accomplish this??

THANKS in advance.I made an adjustment to make it work but I'm still not sure if that's the "correct" way of doing it.

Basically, now I take new_orders LEFT JOIN client_info then LEFT JOIN admin_notes. It returns correct results for now. There isn't much data in the database so I'll have to wait until someone suggests something better or more data is gathered :/Quote
meaning it may or may not be there
- SQLyog is a great tool to view databases and see what is there and make changes with with a GUI. The FREE community edition is limited, but still has many useful features. If you ever lose track of a table etc you can use it to see where it went etc.Looks like a great tool DaveLembke, something I may require down the road but how does that help my problem in joining three tables? Thanks.
2139.

Solve : Programs to respond to programs.?

Answer»

Is it possible to create programs that run in background and give reply to some specific program when it is found running.
Okay, lets make it simpler:

A program that just gives replies to specific program if it is found running or terminates.
with PStools:

batch program, accepts program to view info of as argument.

Code: [Select]@echo off
pslist | find "explorer" /i

the PSLIST program will need to be on your path for this too work.


I think the main confusion is this "replies" to business. a reply implicates PREVIOUS communication between this program you want to "reply" to and the program you are running- how does this occur?Thanks for replying.
Sorry for getting late, OK, example:

The program which I want to write is ProgramMe, and the program to which it will SEND message is ProgramX.
Now ProgramX has suppose three PushButtons on its first screen, and I want ProgramMe to select the second PushButton from that as would have done.wow, that's more troublesome then it sounds.

is the caption of the window always the same? the button? If so, you will need to use some API calls within your program.

First, you'll need to use the "FindWindow" API to find the handle of the window with the caption. Note that if "programX" changes it's caption at all this portion will become much more difficult (if this is the case let me know- I could add that here but it's messy, even in pseudocode).

Armed with the window handle from FindWindow, you will need to start a EnumWindows() call.

EnumWindows will call a callback function you define for every window in the SYSTEM. With every call you will need to use the "IsChild" API routine to determine wether this enumerated window is a child of the window you retrieved with FindWindow earlier. If it is, you then determine, using "GetWindowText", wether this is also the button you wish to emulate a push for.


If it is, you will call PostMessage() to post a proper button message to emulate the click (PostMessage is USED to prevent a deadlock situation between enumwindows and the messagepump of the target window).

And that's all there is to it! LOL.

If course this will REQUIRE some familiarity with the windows API...Okay, thanks, I'll read.
TYVM.

2140.

Solve : In C++ How to write a simple function template??

Answer»

Hello, Looking for a shove in the right direction.
Using a header file "example.h" that defines "2 function templates." One that has to read a set of numbers typed at the keyboard into an array of T. The other TEMPLATE RETURNS the smallest value in the array. Then another file main.cpp uses the template on an array of 4 ints and an array of 5 doubles.

I USED this for the part that returns the smallest value:

template
T Smallest(T *a, int N) {
T min = a[0];
for (int i = 0; i < N; i++) {
if (a<min)
min = a; }
return min;
}

How would I do the first part? Reading the standard input into the array in C++? I am still working on main.cpp as WELL. Any helpful input is greatly appreciated. Thanks in advance.
Though I have not reached that CHAPTER of templates yet, this http://www.cplusplus.com/doc/tutorial/templates.html might help.

2141.

Solve : UI Dialog Properties VB 2008?

Answer»

If anyone can shed a little light for me PLEASE:

I am currently developing the 'solution' through the UI Dialog properties of VB 2008, so my application can be installed onto a computer .

It works ok, installs successfully, creates the desktop icon, start menu icon and programs folder.
...... BUT, when I go into the Control Panel, the uninstall option is there, but not with my own icon it uses the WINDOWS default icon.

Does anyone know how I can get this to use my own icon?

TIASorry, no comments for that but:
"Computers are for LIFE.. not just gaming".
1000 points to pcwizard for that looking at the attitude (towards programming)
of many of my friends.Quote from: Ashutosh32 on February 20, 2009, 08:05:00 AM

Sorry, no comments for that but:
"Computers are for life.. not just gaming".
1000 points to pcwizard for that looking at the attitude (towards programming)
of many of my friends.



I've since found out that the 'Setup' properties has a function to add an icon, similar to that of the projects' properties. EASY when you know how!
2142.

Solve : Printing data sheet?

Answer»

I have a lot of DATA I need to FORMAT onto a PAGE and them PRINT it. What is the best CONTROL to do this. I see there is many different ways to do it.

2143.

Solve : Where to start??

Answer»

Hi there!

WORKED as a Cobol programmer for 10 years. Gave up my career due to poor health and haven’t looked at any coding for 12 years or more. I have no idea what people use these days.

Would now like to write a SIMPLE PROGRAM for use on my PC. I use Windows XP.

I want a simple data INPUT program, a simple sorting and processing program and a report-writing program. Database will be quite large.

Don’t want to incur too much expense.

Which languages are most recommended? Are they easy to learn? What about editors and compilers? Where do I get them? How much do they cost? Should I just find an old and free Cobol compiler?

All suggestions greatly appreciated.

Best WISHES from Michael.

2144.

Solve : bash script help please?

Answer»

hi all, semi-newbie confused.......i am trying to write a script that searches all users directories for words that are certain colors...such as red, blue, so on.......then the display must output this sentence: Username:username, PART of file with the colored word:The BALL is red., Path:/john/mydocs/red.doc

I have played around with this, COMING up with different things but nothing close so here is what i have settled on thus far:

colors='grep -E -r "red|blue|green|yellow" /home'
nameofuser='echo $colors | cut -d "/" -f3'
line='echo $colors | cut -d ":" -f2 | cut -d "/" -f1`
path=`echo $colors | cut -d ":" -f1`

echo "Username:$nameofuser, Part of file with colored word:$line, Path:$path



This is what i have so far. It gives me only the first instance of course. Am I on the right track even on this? If so i know a loop is somehow NEEDED. But I keep secondguessing myself if i even have it right to this point. This shouldnt get too complex considering like i SAID i am a newbie. Please help!!
Just to clarify the output should look similiar to this:

Username:....., Line with color.........., Path:
Username......,Line with color............,Path:
Username......,Line with color............,Path:

and so on

Any help would be greatly appreciated.

2145.

Solve : Java arraycopy method and 2D Arrays?

Answer»

In the programming language Java -

Basically, I am have been trying to use the System.arraycopy method to copy the elements of one array to another, and using a for loop to print out the elements, but I cannot get it to successfully copy the elements of one array to another.

The problem stems I think from my use of two dimensional arrays, because in the parameters for System.arraycopy the source position and destination position can only specify a single value, whereas I am using 2D arrays, which will hold two VALUES.

What can I do?

Here is a little IDEA of the array I have used
Code: [Select] LibraryItem[][] stItems = new LibraryItem[30][30];

//make items for the library
//For books prices £10 - £20
stItems[0][0] = new shortterm.Book(staff.getID(), "Java Now!", "Kris Jamsa", "J amsa Press", 1996,
"1-884-13330-4", 16.95);

stItems[0][1] = new shortterm.Book(staff.getID(), "Java in a Nutshell: A Desktop Quick Reference for Java Programmers",
"David Flanagan", "O'Reilly & Associates INC.", 1996,
"1-565-92183-6", 19.95);

And the arrayCopy method with the code for printing out the object attributes

Code: [Select] System.arraycopy(stItems, 3, refItems, 6, 10);

System.out.println('\N' +
"Price" + " " + " Book Title" +
"\n-----------------------------------------------------------" +
"-------------------------------------------------------------" +
"-----------------------");

for(int i = 0; i < refItems.length; i++){
for(int n = 0; n < refItems.length; n++){
if(refItems[i][n] instanceof reference.Book){
System.out.println("£" + ((reference.Book)refItems[i][n]).getPrice() + " " + refItems[i][n].getTitle() + " by " + ((reference.Book)refItems[i][n]).getAuthor() + ", " +
((reference.Book)refItems[i][n]).getPublisher() + ", " + ((reference.Book)refItems[i][n]).getYearPublished()
+ ", " + ((reference.Book)refItems[i][n]).getISBN() + ".");
}
}

}

2146.

Solve : Data combo VB8?

Answer»

I'm TRYING to GET a data combo to list all the RECORDS in one data FIELD but it will only list the first one. What am I doing wrong.

2147.

Solve : Application seems too small to work [Confuses Me]?

Answer»

Over my years trying to write useful programs, I have always wondered about 2 things..

But first lets have at least some background information so you know what this is all about..



I have some unofficial Patching tools for a few apps, as example a screen saver that i don't even like, but that's not the point...


Most of these tools has 1 major thing to do, Replace EXE, DLL and/or some INI files

If I look how the "patching" is being done by these 3 different examples I got, I can SEE this:

1 PatchM12.EXE
Size=119.94Kb
Contains:
M12.exe Size=8,93Mb
M12.DLL Size=2,14Mb
Extras
Plays music file after user specifies Application's folder (Example C:\Program\M12\) (The music that the user will hear is definitely not MID/MIDI, its 3:47 in length and it contains human voices)

2 PatchWR.EXE
Size=189.94Kb
Contains:
WR.exe Size=2,33Mb
WR.DAT Size=6,94Mb
Extras
Plays music file after user opens this Patcher (The music that the user will hear should be MID/MIDI, since it is only instrumental and it sounds just like any MID music)

3 Patch_Wolf.EXE
Size=249.78Kb
Contains:
Reg.exe Size=12.75Mb
REG.DLL Size=4,56Mb
REG.ini Size=2Kb
Extras
Plays music file after user opens this Patcher (The music that the user will hear is defently not MID/MIDI, its 4:16 in length and it contains female singing)


Now the things I would like to know is these :

1: How do they make the music fit in a way too small file and play it in Real-Time ?

2: How do they compress the DLL/EXE files so hard ? (The filesizes mesured could be wrong, but i don't think so)


Any useful help will be appreciated


NOTE: I'm not uploading the patches, because they are for games playable on Win95, so I don't think anyone will pay attention to them

Edit: EXCUSE me, some misspelling, but who cares as long as you can read it...1. Midi files are just lists of numbers; they can be very small. A midi player written in assmbler can be a few HUNDRED bytes in size.

2. The exe and dll files need only contain the patching code, plus blank space (which compresses very well!). They can get the rest of what they need from the official installed version.

Those sure look like cracks, which is against CH policy.

Most "executable compressors" achieve a compressed size around 25-30% of the original size, which makes me think that your files are merely patching apps plus - only - the patching code which is to be inserted into the official exe or dll files. This is, in fact, what "patching" means.



I've never used a legit patch program that had music, with vocals or otherwise.

And yet 90% of the keygens and cracks I've seen use some form of TERRIBLE terrible music that sounds like a goat being castrated. Don't ask for details on that.BC, I know they can sound awful, but I just wanted to know how they made the music

by the way, I never used illegal copies of anything yet...

The only thing I have used is a nocd patch for a game that I already own, becuase the disc is too damaged to be played with, but installation works...

* Ryder17z tries to remain clam thinking why he havent started doing what many others are doing (Downloading from Illegal sites) ...they embed the music in the program. nothing fancy. a 48kbps Mp3 of the length you've described would likely weigh in around 1MB.Your sound card will accept MIDI commands. These are instructuons, not compressed waveforms. For more infromation pleae read this link:
http://en.wikipedia.org/wiki/Musical_Instrument_Digital_Interface
Notice there is nothing illegal about using MIDI, Per Se. If the MIDI script is from modern composition that is copyrighted, then there would be a possible legal issue.

Quote from: BC_Programmer on February 23, 2009, 09:50:23 AM

a 48kbps Mp3 of the length you've described would likely weigh in around 1MB.

The biggest file size he quoted was 249 KB. And we're talking MIDI here.

Google told me of a ABBA tune:

Quote
MIDI file size: 20480 bytes, media length: 5 min. 30.923 seconds

That's 20 KB.


Oh, I was looking at the wrong filesizes then.

Quote
The music that the user will hear is defently not MID/MIDI, its 4:16 in length and it contains female singing

Probably just "choir ahhs" maybe?Ah, I see, maybe I should try make a midi player in C++

Could be worth a try
2148.

Solve : Base Programming?

Answer» DEAR Help

Please tell me which is the base of programming languges like C , C++, C# and java etc. If I learn C THOROUGHLY ,will it help me in C++, C# , java etc.C++, C#, and Java all have there roots BACK to good ol' C.

yet Java has a mix of VB and C++, so you should learn some VB as well if you want to program in Java
C++ is the closest of the THREE to C, but with classes.
C SHARP(C#) is a mix of Obj Pascal, C++, Java, and a few others.

Hope this helps
,Nick(macdad-)
2149.

Solve : database supporter!?

Answer»

Can anyone TELL me what are the responsibilities of a person who works as a, database support?

Thanks in advanceThat depends on who is offering the position and what they want you to do.

Generically, a database supporter usually assists in the creation and maintenance of a company database...be it a database of products, clients, employees, etc., etc.

Qualifications will more than likely depend on the company's needs and the software they use to maintain their database.

Examples of database software: Access, Oracle, MYSQL, Microsoft SQL ServerThanks Glitch for your reply. Can you tell me what are the latest VERSIONS of these oftwares:

Quote from: Glitch on February 23, 2009, 06:48:56 AM

Examples of database software: Access, Oracle, MySQL, Microsoft SQL Server

And what is the difference between these softwares.Access - PART of Microsoft Office
Oracle - found here: http://www.oracle.com/database/index.html
MySQL - FREE to download and use - http://www.mysql.com/
Microsoft SQL Server - an OS, which isn't free. :p
2150.

Solve : simple data1 help?

Answer»

10 years ago I wrote many programs in VB4, Now I have VB8 and I need to write one for the company I work for. I remember writing a simple program using a data1 control that would add,edit and delete the data. I know it was just a little simple code. Everything I see is miles and miles of code and modules that I don't need and won't work. I am also having troubble getting the simple codes to work. Like the messagebox command. It doesn't work as written in the books. 10 years ago this was so simple to find. Hmmmmmm maybe in my old age I'm getting stupid. ( PLZ no comments on that ) hehehehe

Does anyone have simple project they can send me I can get the idea from.Can you not use VB4?
I recall that it could do both 16bit and 32 bit stuff.
And it was cool with database things.
And the VB4 book would not break you TOES if you dropped it.
I've stayed away from .NET PRETTY much since it came out- I pretty much discovered what you have- They've made everything more difficult, slow, and it's harder to find half the equivalents for VB Classic stuff- such as the Data Control you mention.

A quick look at VB 2005 (which, I believe is VB8) reveals that the default project has a few data-related controls that may be relevant:

BindingSource And BindingNavigator, as well as a "DataSet" control.

Unfortunately I didn't get far with either of these myself- but I'm certain they will be part of the solution- OR-

VB3,4, 5 and 6 each came with "Data" Controls that were intrinsic to the VB runtime. Chances are this is the control you have experience using. Unfortunately, this Control is not AVAILABLE in .NET

On the other hand, .NET does support the use of ActiveX controls. Visual Basic 6 Professional and Enterprise editions both come with a ActiveX control called the "ADO Data Control". In order to get this control into your project, select "Project->Add Reference. Then click the "COM" tab, and scroll down until you see "Microsoft ADO Data Control" in the list. Select it.

It should now be in the toolbox.

the ADO data control should be closer to the Data control you are used to. the only hurdle might be the creation of a connectionstring. I myself have to look it up on google for the proper format, because I forget it EVERYTIME I go to use ADO.

ANOTHER alternative is to reference the DAO libraries and populate your controls via code, but that might be a bit messier then you would like.

Sorry if this didn't actually provide you with a working solution; I haven't used VB .NET and really have no plans to do so in the near future; I hope I pointed you in the right direction.



Quote from: Geek-9pm on FEBRUARY 25, 2009, 01:03:19 AM

And the VB4 book would not break you toes if you dropped it.
Probably would have, considering my three VB2 books weigh over 5 pounds... I would guess the manuals got bigger by VB4...