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.

901.

Solve : Need help with Java - GUI?

Answer»

I am just playing around with Java GUI. Here is a simple code, it has no main method because I haven't got to there yet but I am getting this ERROR:

txtFirstName cannot be resolved
txtLastName cannot be resolved
....
this is referenced to the ButtonHandler class at the bottom of the code in the ActionPerformed method.

And if anyone can explain to me what @Override is for, is that for override ActionPerformed method?

If anyone has any experience with GUI please help, I followed my teacher's example and that's what I got, not sure what's wrong. Thanks in advance guys.

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;

public class Test extends JFrame {
public Test()
{
JLabel lblFirstName, lblLastName, lblAddress, lblStudentNumber;
JTextField txtFirstName, txtLastName, txtAddress, txtStudentNumber;
JButton btnSend;

JPanel panel = NEW JPanel();
lblFirstName = new JLabel("First Name:");
lblLastName = new JLabel("Last Name");
lblAddress = new JLabel("Address:");
lblStudentNumber = new JLabel("Student Number");

txtFirstName = new JTextField(20);
txtLastName = new JTextField(20);
txtAddress = new JTextField(20);
txtStudentNumber = new JTextField(20);

btnSend = new JButton("Send");

panel.add(lblFirstName);
panel.add(txtFirstName);

panel.add(lblLastName);
panel.add(txtLastName);

panel.add(lblAddress);
panel.add(txtAddress);

panel.add(lblStudentNumber);
panel.add(txtStudentNumber);

panel.add(btnSend);

btnSend.addActionListener(new ButtonHandler());
}

public class ButtonHandler implements ACTIONLISTENER
{
@Override
public void actionPerformed(ActionEvent arg0)
{
JOptionPane.showMessageDialog(null, txtFirstName.getText() +
"\n" + txtLastName.getText() +
"\n" + txtAddress.getText() +
"\n" + txtStudentNumber.getText());
}
}



}
You haven't specified a location for each controls. Thou JAVA should automatically perform this task but i think you are miss some code! READ this

import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JTextArea;

/**
* A very simple java swing application.
* Contains button and checkbox. RESPONDS
* to manipulations with these controls by
* changing text in the main text area.
*
* @author audriusa
*/
public class WikiHow extends JFrame implements ActionListener
{
/**
* The button.
*/
JButton myButton = new JButton("Button");

/**
* The the checkbox.
*/
JCheckBox myCheckBox = new JCheckBox("Check");

/**
* The text area.
*/
JTextArea myText = new JTextArea("My text");

/**
* The bottom panel which holds button.
*/
JPanel bottomPanel = new JPanel();

/**
* The top level panel which holds all.
*/
JPanel holdAll = new JPanel();

/**
* The constructor.
*/
public WikiHow()
{
bottomPanel.setLayout(new FlowLayout());
bottomPanel.add(myCheckBox);
bottomPanel.add(myButton);

holdAll.setLayout(new BorderLayout());
holdAll.add(bottomPanel, BorderLayout.SOUTH);
holdAll.add(myText, BorderLayout.CENTER);

getContentPane().add(holdAll, BorderLayout.CENTER);

myButton.addActionListener(this);
myCheckBox.addActionListener(this);

setDefaultCloseOperation(DISPOSE_ON_CLOSE);
}

/**
* The program entry point, this method makes class executable.
*
* @param args the program start up parameters, not used.
*/
public static void main(String[] args)
{
WikiHow myApplication = new WikiHow();

// Specify where will it appear on the screen:
myApplication.setLocation(10, 10);
myApplication.setSize(300, 300);

// Show it!
myApplication.setVisible(true);
}

/**
* Each non abstract class that implements the ActionListener
* must have this method.
*
* @param e the action event.
*/
public void actionPerformed(ActionEvent e)
{
if (e.getSource() == myButton)
myText.setText("A button click");
else if (e.getSource() == myCheckBox)
myText.setText("The checkbox state changed to " +
myCheckBox.isSelected());
else
myText.setText("E ...?");
}
}Quote

And if anyone can explain to me what @Override is for, is that for override ActionPerformed method?

It just points out to anyone reading the code that the next method is over-riding the original. It is not necessary for the code to work.

I think the problem is that txtFirstName etc are only declared within the scope of the constructor; ie. can only be accessed from the constructor. If you want them to be accessed from outdiee the constructor's scope (and you do, you want to access them in ButtonHandler), then put them as properties. Usually there is this structure:
Code: [Select]public class MyClass.....{
//properties here
...
...
...
//constructors here
..
..
..
//methods and nested classes here
...
...
..
} //end class

Hope this shed a little light,

Two-eyes %Sorry for not replying for a while the forum banned me for no reason.

Thank you Two-eyes for pointing that out. I've spent about four hours on Thursday trying to figure things out and now I have a general understanding of how to use GUI and laying it out using GridLayout.

Thank you guys.
902.

Solve : clearing all textboxes in a form?

Answer»

I have googled to find a code in VB2008 to clear all textboxes in a form. I can't seem to GET a code to work. If your textbox its badly name as txtbox1 txtbox2, 3, 4, 5 and so on then you can use this code

For i = 0 to txtbox_ammount
Dim str = "txtbox" & i + 1
Me.controls(str).text = ""
next

This would clear all your txtbox but BAD naming conventionDoes VB2008 really spell "ammount" like that? With 2 'm's?
I'm not sure what the code is in VB but if it doesn't work you can simply overwrite the text fields with empty strings wherever needed. Not the most efficient way to go but if it WORKS, also DEPENDING what it is you're working on.

903.

Solve : PHP and Javascript, need help!?

Answer»

Hey guys,

I have a form with fields "name", "email", and "url". Very simple comments/suggestion form. I am trying to validate only two of the fields: name and email. The validation checked for the INPUT and returns alert pop-up BOX if the fields are empty:

function checkForm() {

var name = document.comment.name.value;
var email = document.comment.email.value;
var url = document.comment.url.value;

var valid = TRUE;

if(name == "")
{
alert("Fill in your name");
valid = false;

}
if(email == "")
{
alert("Fill in your email (ex. [emailprotected])");
valid = false;
}

return valid;
}

Everything works, except that after I click on Ok button the form is still being sent. What could be the problem? Why does the form keeps submitting even THOUGHT the return boolean is false?

Note: I EXCLUDED the

904.

Solve : Starting Programming?

Answer»

Hi, I want to get started programming. I have been told to start with PYTHON, so that is what I am doing right now. I am almost done going through this TUTORIAL, but I would like to know where to go from there.

Thanks,
Google. QUOTE from: Google on November 19, 2009, 03:49:00 PM

Hi, I want to get started programming. I have been told to start with python, so that is what I am doing right now. I am almost done going through this tutorial, but I would like to know where to go from there.

Thanks,
Google.
wrong. you should go here to read the tutorial. AND then surf the entire site to read the DOCUMENTATIONS.
905.

Solve : high card game c++?

Answer»

For schoo we have to make a program that outputs 5 cards and says what the highest is like

your cards are 1 6 3 A K
your highest is A
the computers cards are 4 5 2 Q J
The computers highest card is Q
You win!

We have to do it using a loop, so we cant just use 5 randoms. Now the problem I was having at SCHOOL was that it would sometimes just output 4 numbers instead of 5. I tried to RECREATE the code here at home but it didn't work so well. Although I do have visual c++ 08 express edition and at school they have a 05 version. But anyways heres what I have do far

Code: [Select]#include <iostream>
#include <ctime>
using namespace std;
INT main ()
{
int random1=0, random2=0, count=5;

cout<<"Your cards are ";

do
{

srand(time(0));
random1 = rand()%14+1;
count++;

cout<<""<<random1<<"";

switch(random1)
{

class 2;
cout<<"2";
break;
class 3;
cout<<"3";
break;
class 4;
cout<<"4";
break;
class 5;
cout<<"5";
break;
class 6;
cout<<"6";
break;
class 7;
cout<<"7";
break;
class 8;
cout<<"8";
break;
class 9;
cout<<"9"<<endl;
break;
class 10;
cout<<"10";
break;
class 11;
cout<<"J";
break;
class 12;
cout<<"Q";
break;
class 13;
cout<<"K";
break;
class 14;
cout<<"A";
break;
}
}while (count < 0);

RETURN 0;
}
now Im getting tons of errors for some reason.

Error 2 error C2332: 'class' : missing TAG name c:\users\computeruler\documents\visual studio 2008\projects\high card\high card\high card.cpp 22

Error 4 error C2143: syntax error : missing ';' before 'constant' c:\users\computeruler\documents\visual studio 2008\projects\high card\high card\high card.cpp 22

Error 5 error C2332: 'class' : missing tag name c:\users\computeruler\documents\visual studio 2008\projects\high card\high card\high card.cpp 25

Error 7 error C2143: syntax error : missing ';' before 'constant' c:\users\computeruler\documents\visual studio 2008\projects\high card\high card\high card.cpp 25
Error 8 error C2332: 'class' : missing tag name c:\users\computeruler\documents\visual studio 2008\projects\high card\high card\high card.cpp 28

Error 10 error C2143: syntax error : missing ';' before 'constant' c:\users\computeruler\documents\visual studio 2008\projects\high card\high card\high card.cpp 28
Error 11 error C2332: 'class' : missing tag name c:\users\computeruler\documents\visual studio 2008\projects\high card\high card\high card.cpp 31

Error 13 error C2143: syntax error : missing ';' before 'constant' c:\users\computeruler\documents\visual studio 2008\projects\high card\high card\high card.cpp 31

Error 14 error C2332: 'class' : missing tag name c:\users\computeruler\documents\visual studio 2008\projects\high card\high card\high card.cpp 34

Error 16 error C2143: syntax error : missing ';' before 'constant' c:\users\computeruler\documents\visual studio 2008\projects\high card\high card\high card.cpp 34

Error 17 error C2332: 'class' : missing tag name c:\users\computeruler\documents\visual studio 2008\projects\high card\high card\high card.cpp 37

Error 19 error C2143: syntax error : missing ';' before 'constant' c:\users\computeruler\documents\visual studio 2008\projects\high card\high card\high card.cpp 37

Error 20 error C2332: 'class' : missing tag name c:\users\computeruler\documents\visual studio 2008\projects\high card\high card\high card.cpp 40

Error 22 error C2143: syntax error : missing ';' before 'constant' c:\users\computeruler\documents\visual studio 2008\projects\high card\high card\high card.cpp 40

Error 23 error C2332: 'class' : missing tag name c:\users\computeruler\documents\visual studio 2008\projects\high card\high card\high card.cpp 43

Error 25 error C2143: syntax error : missing ';' before 'constant' c:\users\computeruler\documents\visual studio 2008\projects\high card\high card\high card.cpp 43

Error 26 error C2332: 'class' : missing tag name c:\users\computeruler\documents\visual studio 2008\projects\high card\high card\high card.cpp 46

Error 28 error C2143: syntax error : missing ';' before 'constant' c:\users\computeruler\documents\visual studio 2008\projects\high card\high card\high card.cpp 46

Error 29 error C2332: 'class' : missing tag name c:\users\computeruler\documents\visual studio 2008\projects\high card\high card\high card.cpp 49

Error 31 error C2143: syntax error : missing ';' before 'constant' c:\users\computeruler\documents\visual studio 2008\projects\high card\high card\high card.cpp 49

Error 32 error C2332: 'class' : missing tag name c:\users\computeruler\documents\visual studio 2008\projects\high card\high card\high card.cpp 52

Error 34 error C2143: syntax error : missing ';' before 'constant' c:\users\computeruler\documents\visual studio 2008\projects\high card\high card\high card.cpp 52

Error 35 error C2332: 'class' : missing tag name c:\users\computeruler\documents\visual studio 2008\projects\high card\high card\high card.cpp 55

Error 37 error C2143: syntax error : missing ';' before 'constant' c:\users\computeruler\documents\visual studio 2008\projects\high card\high card\high card.cpp 55

Error 38 error C2332: 'class' : missing tag name c:\users\computeruler\documents\visual studio 2008\projects\high card\high card\high card.cpp 58

Error 40 error C2143: syntax error : missing ';' before 'constant' c:\users\computeruler\documents\visual studio 2008\projects\high card\high card\high card.cpp 582008 Professional Here.


Mostly syntax errors.

It's "case" not class, and you should end each case with a colon...


Code: [Select]

#include <iostream>
#include <ctime>
using namespace std;
int main()
{





int random1=0, random2=0, count=5;

cout<<"Your cards are " << endl;

do
{

srand(time(0));
random1 = rand()%14+1;
count++;

cout << "" << random1;

switch(random1)
{

case 2:
cout<<"2";
break;
case 3:
cout<<"3";
break;
case 4:
cout<<"4";
break;
case 5:
cout<<"5";
break;
case 6:
cout<<"6";
break;
case 7:
cout<<"7";
break;
case 8:
cout<<"8";
break;
case 9:
cout<<"9"<<endl;
break;
case 10:
cout<<"10";
break;
case 11:
cout<<"J";
break;
case 12:
cout<<"Q";
break;
case 13:
cout<<"K";
break;
case 14:
cout<<"A";
break;
}
}while (count < 0);

return 0;

}



*smacks head
anyways, it got rid of errors with ; but changing it to case should do itNow im having a problem were it will only ouput the same number
I also changed the do while to a for
Code: [Select]#include <iostream>
#include <ctime>
using namespace std;
int main ()
{
int random1=0, random2=0, count=0;
cout<<"Your cards are ";
for (;count<5;count++)
{
srand(time(0));
random1 = rand()%14+1;

switch(random1)
{
case 2:
cout<<"2 ";
break;
case 3:
cout<<"3 ";
break;
case 4:
cout<<"4 ";
break;
case 5:
cout<<"5 ";
break;
case 6:
cout<<"6 ";
break;
case 7:
cout<<"7 ";
break;
case 8:
cout<<"8 ";
break;
case 9:
cout<<"9 "<<endl;
break;
case 10:
cout<<"10 ";
break;
case 11:
cout<<"J ";
break;
case 12:
cout<<"Q ";
break;
case 13:
cout<<"K ";
break;
case 14:
cout<<"A ";
break;
}

}

return 0;
}
Ok, I got that fixed and now I have no idea how to find the highest
Any ideas?

Code: [Select]#include <iostream>
#include <ctime>
using namespace std;
int main ()
{
int random1=0, random2=0, count=0;
cout<<"Your cards are ";
srand(time(0));

for (;count<5;count++)
{

random1 = rand()%13+2;
switch(random1)
{
case 2:
cout<<"2 ";
break;
case 3:
cout<<"3 ";
break;
case 4:
cout<<"4 ";
break;
case 5:
cout<<"5 ";
break;
case 6:
cout<<"6 ";
break;
case 7:
cout<<"7 ";
break;
case 8:
cout<<"8 ";
break;
case 9:
cout<<"9 ";
break;
case 10:
cout<<"10 ";
break;
case 11:
cout<<"J ";
break;
case 12:
cout<<"Q ";
break;
case 13:
cout<<"K ";
break;
case 14:
cout<<"A ";
break;
}

}

return 0;
}nvm I got it working

906.

Solve : Just tell me what to do??

Answer»

I can't even guess how many times this questions has been asked but I think I have to ask in my own words to get satisfaction. Mainly, I want to understand how my computer(computers in general work) and want to know what language I should start with. I know there's hardware and software and they all communicate through channels and something controls those channels and that there's a CPU that does basic comparisons of data in machine code and that has to be translated into machine code by , is it assemblers, from high level language written by a person. I think that dll's in windows are common parts of software that all the programs share to make code shorter and I think that has something to do with batch programming. I still do not understand what windows is "sitting on" in my Dell laptop that it is running on. I know there's different layers that OS run on like the KERNAL, that I think MANAGES, I don't know something. But, my question is- to help tie this all together for me, what language should I start with. Quote from: Doug on November 04, 2009, 10:32:48 AM

what language should I start with.
Python.Quote from: gh0std0g74 on November 04, 2009, 04:30:32 PM
Python.
That is a good answer.
No ot satisfied?

Here are some other languages that are like Python..
in a very broad sense.
PHP
Perl
Ruby
Java

In addition, there are code systems based on ht e .NET framework from Microsoft.

I program in Assembler, but I do not recommend it. Quote from: Geek-9pm on November 04, 2009, 04:49:26 PM
in a very broad sense.
PHP
Perl
Ruby
Java[/color]
Java is does not fall into this category.I use VLC media player alot. I what to see what the program looks like. So, I notice that there is a place on the download site for the player to LOOK at the source code. Well, I tried to look at it but could not get it open. Would someone please help me to look at this program. I want to see what a program that alot of people are using looks like. The file is a zip with the B2Z file something. How could I look at this on my computer. I downloaded the file and downloaded some PZ unzipping file and tried to look using wordpad and notepad and could not.

http://www.videolan.org/vlc/download-sources.html.

I'm using Windows XP if that info is revelant.pascal

c
C programming

javaQuote from: gh0std0g74 on November 04, 2009, 04:53:05 PM
Java is does not fall into this category.
Why not?Quote from: Geek-9pm on November 05, 2009, 05:21:28 PM
Why not?
Java, simply is not designed to be a scripting language. Can you imagine you need to do a class and byte compile just for printing hello world? Quote from: gh0std0g74 on November 05, 2009, 08:37:19 PM
Java, simply is not designed to be a scripting language. Can you imagine you need to do a class and byte compile just for printing hello world?
I respect that.
The original question was:
Quote
But, my question is- to help tie this all together for me, what language should I start with.
Python was given as a answer.
I added there are other languages like it in a broad sense. I included Java. Python is often compared to Java and people make arguments as to their merits. Both are wildly used. Both are somewhat easy to learn. Both open up a lot of computer power. That was the basis for my earlier statement.

Then there is java script. But LET us with not go there now. The OP wanted a SIMPLE answer to a very broad study. Namely, to lean more about computers.
Quote from: Doug on November 05, 2009, 03:22:56 PM
I use VLC media player alot. I what to see what the program looks like. So, I notice that there is a place on the download site for the player to look at the source code. Well, I tried to look at it but could not get it open. Would someone please help me to look at this program. I want to see what a program that alot of people are using looks like. The file is a zip with the B2Z file something. How could I look at this on my computer. I downloaded the file and downloaded some PZ unzipping file and tried to look using wordpad and notepad and could not.

http://www.videolan.org/vlc/download-sources.html.

I'm using Windows XP if that info is revelant.

You tried to use VLC to look at the binary data of the program. The source code is the code before it is compiled. For example: C++ would have a source code with such as FileName.cpp - After you compile it, it would become FileName.exe. Unless you decompiled the .exe file you were just viewing the binary data of the .exe file.

If you want to look at source code for a program, they usually won't give it to you (for free). If it is open source you may be able to download the code itself. An example of a program that has source code that I used for some C++ reference would be PeerGuardian 2. You do need Microsoft Visual Studio 2005 to be able to open the project however.
907.

Solve : JavaScript to Read & Write to Cookies?

Answer»

I am working with a friend to make a web page based video game where he is going to do the artwork etc and I am going to do the programming and I hit a wall with saved game state information.

To keep the server from getting flooded I am trying to run the majority of the game logic at the users side and have the HTML content at the server side such as artwork etc.

I have a javascript that will take a user INPUT and save it to a cookie and greet the person the next time they GO to the game site, and where I am having difficulties is in scripting up a way so that the last saved game state saved in their local game cookie determines the page to load when they visit the site again.

Any suggestions? I can supply my code if needed. Just MAINLY stumped on having a script that reads in cookie content that then determines the APPROPRIATE page to load ( basically where they LEFT off in the game last.)

908.

Solve : Sprite?

Answer» HI there folks
i am trying to create a game on VB.NET but lately i been using picture box. The thing is that when using an image with transparent background with picturebox you cannot see the transparent background but instead some colour that is set on the forms. But the transparent background do SHOW up if you put the setting to transparent but it doesn't work to the background form images. I believe that picture box is not a way to create images for games. I heard from my friends, he said that to LOOK up using sprite, but the TUTORIAL that i found on google doesn't work as there is no declaration code!
Doesn't anyone here know how to use sprite or can you point me to a correct direction on the internet? I only found a proper tutorial on C# but not VB. Thou the concept is the same but not with sprite!

Thank youDoest anybody know how to make picturebox transparent, i MEAN fully transparent so when i overlap two pictureboxes i shouldn't have a square boarder?use the image control.
909.

Solve : How i can use usb wirless (bluetooth) in car ??

Answer»

Hi,

I programing new PROJECT in my university thats about use wirless USB in car by
pc to car & car to pc using BLUETOOTH .

I need help plz .

thanx

910.

Solve : To make sure !?

Answer»

Hi all ..

What is the language that was designed by the command prompt , ms-dos?



Is it possible to design an anti-virus program by programming through the " Dos Edit " ?

::::::::::
c:\edit

::::::::::

Thanks

AlexYes but to much hassle:
Such as installing component for the programming language
Connecting to database
Installing controls
And others stuff that i wouldn't know!Thanks

but i need more .

I programming new program for anti-virus

and i need more information about dos

it's good lang to kill viruses in my opinion .

Good luck

You CAN NOT make an av program with batch. Simple as that.

Quote from Zylstra:
Quote

Face it, DOS cant do what you want it to.

For more information on what dos CAN'T do, please go here.Umm, I think another factor is that DOS is not a language... DOS is actually quite good for hacking windows system. (BTW that one thing where it says access denied, well that's stupid, because if you can right click you'll understand). I can change any of the accounts passwords. Well, that's not really hacking, that's just type a few commands. I can also see the I.P. Addresses of the other people connected to my modem (example: brothers). Meaning, if I can get on there account I can probably find out there password, meaning I have access to their computer. You know, DOS does have a few tricks up it's sleeve once in a while. I told them they shouldn't make accounts on my computer .Quote from: BatchFileCommand on November 04, 2009, 07:16:33 PM
DOS is actually quite good for hacking windows system.

No. It isn't. It's useless for that.

Quote
(BTW that one thing where it says access denied, well that's stupid, because if you can right click you'll understand).
Not even sure what your talking about.

Quote
I can change any of the accounts passwords.
No. you cannot. Not without the current password.
Quote
I can also see the I.P. Addresses of the other people connected to my modem (example: brothers).

you can see this in a router/modem config page too. nothing special about it.

Oh, except you can see the same thing in Network Neighborhood/network, by right-clicking on the computer. It gives you the IP address. There is nothing "hidden" or "secret" about them.
Quote
Meaning, if I can get on there account I can probably find out there password,
How? You cannot get the current users password through any "DOS" command (I put DOS in quotes because I doubt you've actually used a computer that was actually running DOS because if you had you would realize how useless it is and how it is merely a method of performing tasks using commands, rather then using the windows GUI. Nearly everything you can do in the Command Prompt you can do with the windows GUI; and those thigns you cannot do in the GUI are nowhere near cracking the password. (warranted, I'm sure there are third party applications that crack the LM hash or something, but just because the programmer is too inept to make a proper GUI application (which is good, because like most "haxxors" they'd probably embed some terribly awful music into it) has nothing to do with Command Prompt, and even less to do with DOS. There are applications that do the same thing within the windows GUI, does this make the GUI good for hacking? No. it's a GUI, a vessel to run programs.


I tried to search for it, but there was already a long rant (not by me) about this subject. The fact that wannabe's hear about the "power of the command prompt" and don't hear the rest of it means they have to paint the picture for themselves. to they invent all sorts of fantastic tales about how they haxxored their principals "box" using find /i, or something equally fallacious. the problem is their friends, being wannabe haxxors as well, adopt the principal of "make it up as you go along" so pretty soon the school is a murmur with the ramblings of 3l33t haxxors telling their stories of how they trained the class gerbil to run through a maze, eat some cheese, and then school n00bs in a game of doom before it haxxored the bunny's box, took a nap and then haxxored ebay and paypal and got some oreo's DELIVERED to it's house and subsequently died of a heart attack.

The above is unfortunately no less ridiculous then the various "stories" I heard while in school by what were supposedly my peers:

"I totally schooled him with a DOS command"

"I hacked his box when I was at his house, I totally unplugged it, he was so pwned"

Yes. It's true. And this is only the tip of the iceberg; adding to this issue is the fact that teachers and other school staff are PARANOID about what the students are doing online. A Prime example being when I was working with QuickBASIC on several occasions. The librarian insisted that I couldn't use QuickBASIC because any program that uses a DOS window is bad.

I didn't realize it at the time, but this attitude is universally ubiquitous with almost any staff member, aside from those who actually know that a mouse port is not a cute little van built for rodents. This only makes things worse, as otherwise smart students are led to believe the same paranoid, delusional crap that the uneducated teachers do. Quite a sad state of affairs.

This is not to mention the complete pervasion of games like "world of warcraft" a world where computer nerds can try to recluse, and at least pretend they have 500 pounds of pure muscle and can crush a lemurs skull with one hand , when in fact they have trouble crushing a grape with both hands. the problem is said "nerds" (who are actually a lesser sub-species called the "wanna-be" nerd, who only thinks that they are a nerd. They, without realizing it, try to learn as much as possible about computers in order to appear "cool" to their nerd friends, of whom a majority are also wanna-be nerds who are doing the exact same thing. this is in fact where these conversations sprout up from, as the wanna-be's mix terms without abandon.

"Yeah, I so totally SQL'd him so bad, he was such a WYSIWYG"

"Oh, I know who you mean, I bet I schooled him with PERL* the other day"

*Perl

Quote
haxxored ebay and paypal

Hi, BC. Nice to see someone on CH who is not a complete p***k. It sure has gone downhill lately.
doctor hack
I understand your question to be simply you want to do an Anti-Virus program that can start and report at the command prompt. Yes, there are some advantages to that. (Ask me if you want me to expand on that point.)

But first, let me say that if you do not already have two years of experience in any kind of computer programming, it will be a hard job. But it is not beyond the ability of someone who is very STRONGLY motivated.

You will need to learn the C language, which can run from the command line. You will later make a library of functions that give you low-level access to all the files in the system. And you must have a database of Virus SIGNATURES. You may be able to borrow a database from the Open Source Community.

The above, I think, is the best short general answer to your question.
Quote
doctor hack
I understand your question to be simply you want to do an Anti-Virus program that can start and report at the command prompt. Yes, there are some advantages to that. (Ask me if you want me to expand on that point.)

But first, let me say that if you do not already have two years of experience in any kind of computer programming, it will be a hard job. But it is not beyond the ability of someone who is very strongly motivated.

You will need to learn the C language, which can run from the command line. You will later make a library of functions that give you low-level access to all the files in the system. And you must have a database of Virus signatures. You may be able to borrow a database from the Open Source Community.

The above, I think, is the best short general answer to your question

Thanks for ur advice ,

I have another question

How can run DOS environment under any operating system

thanxThere are two problems with your idea. DOS is an operating system. Therefor there is no DOS, other than in an old computer RUNNING DOS. The second problem is that what you think is DOS, is actually CMD.EXE, a command-line interpreter. It is in WINDOWS OS computers, so if you had a batch file, and you made it in XP, it will work in VISTA (if it works in the first place). Macs don't have CMD.EXE, so they can't run batch files. And cmd.exe is NOT "DOS".
Quote from: doctor hack on November 16, 2009, 12:47:29 AM
How can run DOS environment under any operating system
you can't just run DOS within an already INSTALLED operating system. What you can do is run it via a virtual machine. eg vmware.
911.

Solve : COM object?

Answer»

Hi
I have created a COM class in VB Script.
How can I include this class in the library, so that I can later use this class's functionality in a program written in VB Script.

please help.

thanks.If this is related to your other post and you did use the COMPONENT wizard, you should have a .WSC file.

Next step is to register your component with regsvr32 path\componentname.wsc

You can use your component in other scripts by using set object = CreateObject(progid)

progid is the name you assigned in the registration section of your component.

Hope this helps. Quote from: Sidewinder on April 13, 2008, 03:56:53 PM

Next step is to register your component with regsvr32 path\componentname.wsc


where do we write this syntax?

Thanks for help. The default location of regsvr32 is the system32 directory. You can RUN the utility from either the command prompt or the start==>run box. There is a /s switch to eliminate any message boxes.

You can GET the offical information here.




description="My Test Component"
progid="Component.TestScript"
version="1"
classid="{2154c700-9253-11d1-a3ac-0aa0044eb5f}"








Function factorial(n)
If isNumeric(n) Then
If n <= 1 Then
factorial = 1
Else
factorial = n*factorial(n-1)
End If
Else
factorial = -2 ' Error code.
End If
End Function
]]>



I copied this as a wsc file and stored it in d drive.
in cmd when i am typing regsvr32 d:\component.wsc

I am gettin the following error:

[3,2]A required attribute is missing : progid, clasid, or classid.

I don't see any thing missing?

then what's the problem?

Thanks for helping me.
There was a name property I COULD find no reference to. There were also some missing tags and a missing parameter for the factorial function.

Code: [Select]<?xml version="1.0"?>
<component>

<registration
description="My Test Component"
progid="Component.TestScript"
version="1.00"
classid="{2154c700-9253-11d1-a3ac-0aa0044eb5f}"
>
</registration>

<public>
<method name="factorial">
<PARAMETER name="n"/>
</method>
</public>

<script language="VBScript">
<![CDATA[

Function factorial(n)
If isNumeric(n) Then
If n <= 1 Then
factorial = 1
Else
factorial = n*factorial(n-1)
End If
Else
factorial = -2 ' Error code.
End If
End Function

]]>
</script>

</component>

Good luck.
912.

Solve : need help with scriping languages?

Answer»

dear friends,
i am a programming student, and learn it in the college. but i'm still new to scriptin languages. PLS tel me in simple words what is a SCRIPTING language, and whats the diff betwn JAVA program and a JAVA SCRIPT, what's a PHP script? is PHP just a scripting language and nothing else? what other scripting languages are out there, which is the best?START here

Good luck.

913.

Solve : MS -DOS and GWBASIC?

Answer»

Is there a way to change a GWBASIC program so it will run in windows?
The program was written in 1990 and is run in dos 2.11 from a floppy on a Toshiba 1000.
I am TRYING to run it on newer computers and it will not run. It is used to program a machine. If I try and open the program on a newer computer the screen just flashes up and goes AWAY. Any help at all.
Thanks
ShannonWhat operating system is running on the 'newer' computer?

Do you have the source code for the GWBasic program?

Quote

It is used to program a machine.
Does the program access ports (com1 etc)?

I have tried to run it in Win 98, Win xp,and yes it uses com port in fact it uses a serial port connection to machine ( 9 pin 25 pin) which is hard to find, I have used USB but run into CONFLICTS. After interring the information in the machine it writes back to the disk to save the info and this is where it hangs. I have taken two older comm and just put IBM DOS 5.0 on the hard drive and it works on the Dell Latitude CP 233XT, but the Dell is about to die, the other is a Toshiba 325CDS and this is where I am having the problem. That is why I need to be able to run in windows.
Thanks for the reply and any help I thank You for.
Shannon In the Win 98 system have you tried amending Config.sys to boot to DOS and run the program on there?

Most versions of Basic cannot access ports when running within Windows XP and need specific additional routines (THIRD party utilities and the like) to do this. One of these specific to NT/XP is Porttalk which might suit your purpose..

Porttalk is discussed here..







914.

Solve : Javascript Loading Sign?

Answer»

I want to use these symbols as a Javascript loading sign (In other WORDS it animates the text so that it looks like a turning line):
|
/
-
\
|Quote from: Prentitious on April 12, 2008, 10:36:38 PM

I want to use these symbols as a Javascript loading sign (In other words it animates the text so that it looks like a turning line):
|
/
-
\
|
http://http://ftp://Code: [Select]Quote
Only have IDEAS, and I work with c++ and c# not javascript so if anyone else has any better ideas then feel free to post. You could always make an animated gif. Which wouldn't be hard to create.

you could also possibly, if there was a way to clear whats being shown on screen.....for example in c++ (just an idea) you could:

Code: [Select]cout &LT;< "|"; //prints to screen
system("cls"); //clear screen
cout << "/";
system("cls");
cout << "-";
system("cls");
etc.

between each, you could EVEN have in a timer, or sleep time of so many seconds before it turned.
915.

Solve : Realy stuck whid programming in VB6 (external start of the funktion)?

Answer»

Well i hawe trided most things but i cant seem to get it to wurk.
So i'm asking you to take a loock on my coding eather chanage it or mail me the code or an example so that i can change it myself.

I hawe included all information. (i think)

All the vb6 files
A .TXT file whid the instruktions of the prog and what i hawe problems whid
A .txt file whid the code (fore the ones that dossent hawe VB6)
A compiled wersion of the prog
A pic of the prog whid the TEXT box names
Notes in the prog telling what the code string does(or is ment to do)

If you need more info send me a PM or mail me (the mail is in the "What to do" file)

PS i hawe checked it whid AVG anti VIRUS scaner no viruses.

[recovering space - ATTACHMENT deleted by admin]if nobody has fixed it yet, try http://z15.invisionfree.com/ISURA_Solutions for more help-:BUMP:--:BUMP:-

916.

Solve : c#sharpdevelop window size?

Answer»

How would I go about checking the mainform window size? I am wanting to write an if then state that more or LESS SAYS that

Code: [Select]if (window size == (360, 105)){
do whatever
}

or

Code: [Select]if (window size == minimum size){ // (360, 105) is the minimum size for the window
do whatever
}
FORMS have a width and height property which you can check after the fact:

Code: [Select]if form.width &LT; 360 Or form.height < 105 {
do errorcondition
}

You could also do this in the onResize event for the form and notify the user immediately if the form goes below the minimum size.

I'm learning C# just RESEARCHING your questions.

Good luck.cool, thanks.

917.

Solve : c# sharpdevelop keydown event/ drag window?

Answer»

Im creating a search bar that doesnt have a button. So im figuring i NEED a keydown event to take whats in the search. How would I go about creating:

Code: [Select]if(ENTER is PRESSED)
{

}

I can do the other stuff after that.

Also, I am wanting to be able to drag the window from a panel at the TOP of the window, and not from the windows title, and controlbox.

how can this be done? Thanks.
I'm guessing your search bar is a control you put on the form. Microsoft can explain this BETTER than me. Well maybe not better, but with more authority.

cool, thanks.

918.

Solve : c# sharpdevelop taglib mp3 header tags?

Answer» HEY, IM trying to incorporate the the dll, taglib, known to be useful to retrieve mp3 HEADER tags. Everything is fine until I run the program, and I get this.

Code: [Select]Exception TagLib.CorruptFileException was thrown in debuggee:
First MPEG header could not be found.


I have the code set to only effect mp3's, and the code im trying to use is.

Code: [Select]string path = @"" + info.Root + "Documents and Settings\\" + System.Environment.UserName + "\\My Documents";
foreach (string str2 in Directory.GetDirectories(path))
{
foreach (string str3 in Directory.GetFiles(str2))
{


if (str3.Contains(".mp3"))
{
TagLib.File file = TagLib.File.Create (str3); //<---------says error occurs here

this.libraryGrid.Rows.Add(file.Tag.Title, "", "", "", "" );

Any ideas? THANKS.
919.

Solve : msdos programming?

Answer»

more|more >>>here.http://www.perl.com/Here a little code that runs under a DOS and prompt for a operation to compute (works fine only without comas and small numbers :-/ )

@echo off
title Little calc -- Enter a operation to compute (ex 5+2) -- Exit : Enter
prompt $B$S

:debut
set /P result="compute ? : "
if "%result%"=="" goto :EOF
set /A result="%result%"
echo Result : %result%
set result=
goto :debut
i THINK you were talking about the batch files in msdos.

though they contain basic programming techniques, i dont think you can really PERFORM addition or any such things using msdos.

if you are really interested in knowing about batch files
and how are they created, you can follow the link below.

http://home.att.net/~gobruen/progs/dos_batch/dos_batch.html

please post if you know anything else about programming in dos.

bye
If you want to do what you said Microsoft Visual Studio.NET is ONE of my favorite software to do it in. Or Excel is also easy but not exactly writing commands or code.it is great to see some one else also knows the value of MS-DOS.

With every MS-DOS disk set (3.5" floppy disks) there is a utility called debug.

you can create programs using this utility.

It is clumsy, awkward and you have to design it on paper using pseudocode and translate it manually to assembly code and then type it in debug to assemble it into a .com file.

Pseudocode(an imaginary language that you define some rules for yourself) is needed for understandability but it is possible to do what you wish completely in MS-DOS alone.

I used MS-DOS 5.0.

Batch processingcombined with redirected input, debug , and your own assemble language routine is clumsy and slow but it is flexible and free (well at LEAST not an extra cost.)

This requires knowledge of your computers CPU instruction set. you should be able to download some reference from the manufacturer( intel[/url] ftp://download.intel.com/design/processor/manuals/ [/url] has some manuals for the x86 family)

I don't have any links to MS-DOS reference material.

have lots of fun!!!!UnAssembler, i am glad to see that there are still some people who know about proper programming!
Quote from: Dias de verano on April 07, 2008, 03:39:58 PM

UnAssembler, i am glad to see that there are still some people who know about proper programming!

what is "proper programming" , by your definition. just curiousQuote from: ghostdog74 on April 12, 2008, 08:31:57 PM
Quote from: Dias de verano on April 07, 2008, 03:39:58 PM
UnAssembler, i am glad to see that there are still some people who know about proper programming!

what is "proper programming" , by your definition. just curious

Don't folks do irony where you come from?

u guud at programming?? cos i got this assignment n i'm really finding it hard to solve it.......

task 3...20 marks
the administration staff and manager will access this system via an initial system entry screen with a PASSWORD- this will give access to a main menu screen. the main menu will provide a choice of access to the following screens:

a. add /delete nurse
b. update nurse details
c. add nursing hours worked
d. add/delete institution
e. update institution details
f. add request for nurse
g. search available staff/ complete request
h. print report (manager only)
i. exit

(i) using pseudocode, write the top level code for a module showing how the various screens can be accessed.

note the pseudocode for add, delete, update , search, print and exit procedures is not required.

(ii) Draw a flowchart for the above module in part (i)
920.

Solve : VB Script help?

Answer» HELLO,

If we want to enter some data in a text file using VBScript we use:

with objectname

.writeline "abcd"
.writeline "efgh"


but what if we want to MAKE entries in database, say an excel sheeet?

what is the syntax for that?

Please help.

:)Thankyou.Excel spreadsheets can be ACCESSED EITHER through the Excel object (see snippet) or with an ADO connection.

Code: [Select]Set xlApp = CreateObject("Excel.Application")
Set xlBook = xlApp.Workbooks.Add()
xlApp.Visible = True
xlApp.Cells(1, 1).Value = "Test value"
xlBook.SaveAs "c:\scripts\foobar.xls"
xlApp.Quit

Where is the data coming from? Each cell: cells(1,1) is addressed with row, column coordinates. By using variables for the coordinates, it should be easy enough to READ a file and place the data in the spreadsheet.

921.

Solve : Java Questions?

Answer»

Its been about two years since I learned java BASIC's. But I dont know what complier they where using. What are some good ones?? Also if I want to use an image would it have to be an applet an would I use system.println I forgot but I have my notes to put the images in.I was able to find a complier but is that how you code an image into java? Like if i wanted it to display.You should use Sun's compiler. You get it when you download the Java SDK.
You will need to explain further what you're trying to accomplish with that image of yours. But I can tell you that what compiler you choose to use have NOTHING to do with adding pictures to an applet.Well what I mean is that I want the user to input data an based on that selects a noted photo. But I dont know how to make the photos appear if its any differnt from displaing text.Most languages have a container type control to handle images. In Java try using the setIcon method of a JLabel control.

Good luck. I am not a noob!!!I know quite a bit of c but I would like to use it in my web pages. Do I have to learn Java? (i tried to read a book on it but it looked pretty weird) You are a noob

Apperntly you are, heres why you posted in a question that isnt covering what you want to do, also you dont need java to make a site unless you want applets or something like that, you need to learn HTML an php. Html will build the site an php will make SURE that its not jacked.

NOOBS???

922.

Solve : Javascript asp's?

Answer»

I am not a noob!!!
I was reading a javascript book the other day and I found that if you had IIS then you COULD make ASP's without having to buy a web page. My COMPUTER is running windows 2000 professional and it was not installed by default. I do not have access to the CD and when I looked it up on the MICROSOFT site, it didn't appear to be there. Can anyone help me?You will need your Win2K install disc if you want to install IIS.
Else you will have to look at alternative web servers.
http://www.google.com/search?hl=en&q=asp+web+server

Btw. could you please stop with the scrolling text in all your posts, it is extremely annoying.

923.

Solve : pls help me!?

Answer»

can someone teach me how to DISPLAY this...

*
***
*****
*******
***JMH***
*******
*****
***
**
*

using C++ programming or java,,using nested LOOPS in C++ or java programmingyou can TRY this site: http://sourcecodesworld.com/source/LanguageHome.asp?LangId=2
this site help me a LOT,..,

924.

Solve : vba help?

Answer»

hi all,

I have a string in outlook VBA that has many LINE BREAKS in it. I'd like to remove these line breaks so all the text is on one line.

Any IDEAS how???


When I run "msgbox strString" i get this;


Code: [Select]This is line 1


This is line 3


This is line 5

When I'd REALLY like to have;

Code: [Select]This is line 1 This is line 3 This is line 5

Any help would be fantastic!!!

Cheers guysSomething like this may help:

Code: [Select]strString = Replace(strString, vbCRLF, " ")
msgbox strString

925.

Solve : Programing??

Answer»

Hi I would like to start PROGRAMING I have already learned Quick Basic but I'm looking a windows based beginner programing language thats easy to learn. Preferably for Windows XP, Thanks. Visual BasicPython. If you know QBASIC then learn Visual Basic. Google 'Visual Basic 2008 EXPRESS Edition download' and go to the microsoft link.

One thing about "programing" is that you have to spell THINGS right. There are 2 'm's in programming.
Ohhh c'mon Dias - that's a bit tough.

Catch the online dictionary here..

LOLCompilers and/or interpreters are extremely unforgiving when it comes to LACK of attention to detail.
I AGREE with Dusty, go with Visual Basic. You'll feel right at home.

You need the .NET Framework 3.5 in order to run Visual Basic 2008 Express Edition.Ok tanks guys

926.

Solve : Strangeee?

Answer»

I wrote a C program, I DEBUGGED it and everything, and it worked fine. Then I created the executable and when I ran it, the program behaved differently than when it was in debugging mode.
Then I took the executable on another PC, and when I ran it, it behaved like when it was still in debugging.

What can this be?

P.S. The part that behaved differently that I needed to print from an ARRAY of strings. On one PC it printed a certain string while on the other PC it printed another.I have only one answer.
Are there any breakpoint you haven't remove?
Having it work on one MACHINE and not the other to me indicates that the user input (from you or the system) was different for each system. Where they running the same OS?

FBI was taught 'C' on a course which
a) every day would have us recite ".... error .... the RESULTS are undefined"
b) reinforced this by using a time sharing mainframe that gave a core dump at every bug.

Typically 'C' compilers have option switches to control how well they examine the code and warn of errors / ambiguities, or whether the compiler should "help" by not warning, but making its "best guess" of what you meant.

Run time errors may involve illegal access outside the intended range of memory. Anything could affect the "undefined results", including the order of loading programs on different "victim" machines.

Regards
Alan
No I did not use any break points and they were running the same OS (both XP). I guess the problem is some memory leakage or something like that...

927.

Solve : nid help( thesis project)?

Answer» NID help,..i am a student,..my thesis project is sales and inventory system,...i have a problem in my Point of Sales,..my system is accepting a check for PAYMENT,..how can i handle this situation,...the payment should not reflect as a cash in the database,...YES i do that,...but how if the check is incash to the BANK,..what should i do???this is easy to all of U,..plss help me,...thanks in advance
928.

Solve : user previliges---help?

Answer»

what is the concept of,..user access level in the system??i make it in VISUAL BASIC,..i do check boxes and every check box have the name of modules one's it is check the module can access by the user,....it is OK,...please give me the BEST thing in MAKING a nice way of user access level forms

929.

Solve : c++ win api questions?

Answer»

im learning c++ win api.....and trying to add nodes to the treeview box it created.......this is what i have so far more or less:

Code: [Select] MSG msg;
HWND myDialog = CreateWindowEx(0, WC_DIALOG, NULL, WS_OVERLAPPEDWINDOW| WS_VISIBLE,
0, 0, 721, 344, NULL, NULL, NULL, NULL);
//__________________________________________________
//CreateWindowEx - create the main window
//0 - for now supply this 0
//WC_DIALOG - window class name, predefined constant WC_DIALOG is used to create dialog boxed
//"MUXIC PLAYER" - title test of the window
//WS_OVERLAPPEDWINDOW | WS_VISIBLE - styel WS_VISIBLE means make this window visible
//400 - X coordinates on screen
//100 - Y coordinates on screen
//200 - Width of the Window in pixels
//200 - Height of the window in pixels
//NULL - parent window handle - for now supply Null
//NULL - do
//NULL - do
//NULL - do
//__________________________________________________

CreateWindowEx(0,
WC_TREEVIEW,
0,
WS_CHILD | WS_VISIBLE,
4,
29,
169,
197,
myDialog,
(HMENU)libTree_id,
NULL, //instance
NULL); //user defined info

I have found stuff on doing nodes, but with no luck been able to implement them into my PROGRAM without out right taking the code, and revolving EVERYTHING around the treeview.

also i would like help on equivalents of c# .net framework:

1. minimize/maximize on button click
2. add panels
3. dock
4. datagridview


if anyone can point to right locations that would be great. thanks

930.

Solve : Problem with .vbs cutting off words?

Answer»

I have a script that I am working on for my internship. What it does is it searches the hard drive for GIVEN file names, and then if it FINDS the file names, it deletes the folder. Well the only problem is that if the filename is under a folder like C:\windows or C:\program files I don't want it to delete the entire folder, just the folder names and the individual files I list. CURRENTLY I am working with this code
(I hope it is the latest version, a few WScript.Echo things might be missing, but it is mostly complete.
Code: [Select]Const ForReading = 1

strComputer = "."
i=0
Set fso = CreateObject("Scripting.FileSystemObject")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set f = fso.OpenTextFile("H:\gameLocations\gameList.txt", ForReading)

Do Until f.AtEndOfStream = True
retString = f.ReadLine
fname = Split(retstring, ".")(0)
fext = Split(retString, ".")(1)
Set colFiles = objWMIService.ExecQuery _
("Select * From CIM_DataFile Where FileName = '" & fname & "'" & " and Extension = " & "'" & fext & "'" & "")
'WScript.Echo "Searching for " & retstring
For Each objFile in colFiles
If InStr(1, objFile.Caption, "c:\windows") > 0 Then
WScript.Echo "Testing"
WScript.Echo retstring & " Found In Windows...Not Deleting"
'Here is the start of my delete script
searchFileString = "H:\gameLocations\lists\" & fname & "_folders.txt"
WScript.Echo searchFileString
Set d = fso.OpenTextFile(searchFileString, ForReading)
Do Until d.AtEndOfStream = True
folderName = f.ReadLine
folderPath = objFile.Path & folderName
strFolder = Left(objFile.Drive & folderPath, Len(objFile.Drive & folderPath) - 1)
WScript.Echo strFolder
'fso.DeleteFolder strFolder, True
'Here is the end of my test script.
Loop
i=i+1
Else
If InStr(1, objFile.Caption, "c:\program files") > 0 Then
WScript.Echo retstring & " Found In Program Files...Not Deleting"
WScript.Echo "Maybe I will code something to delete all the individual files?"
'Here is the start of my delete script
searchFileString = fname & "_folders.txt"
Set d = fso.OpenTextFile(searchFileString, ForReading)
Do Until d.AtEndOfStream = True
folderName = f.ReadLine
folderPath = objFile.Path & folderName
strFolder = Left(objFile.Drive & folderPath, Len(objFile.Drive & folderPath) - 1)
WScript.Echo strFolder
'fso.DeleteFolder strFolder, True
'Here is the end of my test script.
Loop
i=i+1
Else
WScript.Echo retstring & " Found In " & objFile.Drive & objFile.Path
WScript.Echo "Removing Files/Folder " & objFile.Drive & objFile.Path
strFolder = Left(objFile.Drive & objFile.Path, Len(objFile.Drive & objFile.Path) - 1)
WScript.Echo "Maybe I will code something to delete all the individual files?"
fso.DeleteFolder strFolder, True
End If
End If
Next
Loop
If i > 0 Then
msgbox "Alert!, Found something in the windows directory or the program files." & Chr(13) & Chr(13) & "You might want to reimage the computer to take care of the problem."
Else
msgbox "Success, Computer is clean."
End If
f.Close

The only problem is that it OUTPUTS something like this.


If you notice, I have a folders list in the .txt file but on the cmd window it shows something like C:\windows\suppor meaning it lost the t in support. It is not just that line, it is some of the other lines, but its not every line.Quote

a few WScript.Echo things might be missing, but it is mostly complete.

Maybe I'm just tired but I can't for the life of me see where the literal ">folder to delete" is generated.

On the other hand you may actually have folders with those names. Could you point out where that message originates?

realized what it was, I took 1 character off of the string for the ENDING / that was never there because I copied and pasted from below.

Would that make this line look something like this
Code: [Select]strFolder = Left(objFile.Drive & folderPath, Len(objFile.Drive & folderPath) - 1)

Code: [Select]strFolder = objFile.Drive & folderPath
Yeah, that works. Nice thing about VBS is you can use unnamed objects to slice and dice data without ever changing the underlying source data.

Quote from: Sidewinder on April 24, 2008, 04:33:55 PM
Yeah, that works. Nice thing about VBS is you can use unnamed objects to slice and dice data without ever changing the underlying source data.



Not unique to VBS by any means.
931.

Solve : Batch scripting help?

Answer»

I'm trying to write a batch file that will display a list to the user, have them enter their choice, and then do something. Here's what I have now:

Code: [Select]@echo off
echo 1. BL (main)
echo 2. BL (sound)
echo 3. MS-DOS

choice /C:123 /N
set OS=%errorlevel%

if "%os%"=="1" echo hello1
if "%os%"=="2" echo hello2
if "%os%"=="3" echo hello3
The problem is that nothing is put into os. When I try printing errorlevel after the choice line it doesn't print anything, but shouldn't it be equal to the user's choice? I'm using MS-DOS 6, if it matters.

Thanks!Errorlevel is not set as an Environment Variable but as a Return Code. You must set the Return Code as an Env Var if you wish to test it.

So you could use:
Code: [Select]@echo off
echo 1. BL (main)
echo 2. BL (sound)
echo 3. MS-DOS

choice /C:123 /N
if errorlevel 3 set errorlev=3
if errorlevel 2 set errorlev=2
if errorlevel 1 set errorlev=1

From here on the Return Code is available in the Environment Variable %errorlev%

This is WORTH reading.

Good luck
Ah, OK. Unfortunately, it's still not working - with your code it printing errorlev with 'echo %errorlev%' always prints 1.

Thanks.Quote

echo %errorlev%' always prints 1.

There is a reason for this. Errorlevel 1 means "errorlevel 1 or greater" so the test will always be true, so gotos are needed if 3 or 2 are chosen

@echo off
echo 1. BL (main)
echo 2. BL (sound)
echo 3. MS-DOS

choice /C:123 /N

if errorlevel 3 goto choice3
if errorlevel 2 goto choice2
if errorlevel 1 goto choice1

:choice3

echo you chose 3
goto next

:choice2

echo you chose 2
goto next

:choice1

echo you chose 1

:next


Sorry, I had a brain malfunction...

Reverse the order of the IF statements to be 1 2 3 not 3 2 1

Here's another version with a couple of embellishments:

Code: [Select]@echo off
cls
echo.
echo.
echo 1. BL (main)
echo 2. BL (sound)
echo 3. MS-DOS
echo.
echo.
choice /C:123 /N " Enter your choice..... "
cls

if errorlevel 1 set errorlev=1
if errorlevel 2 set errorlev=2
if errorlevel 3 set errorlev=3

echo.
echo.
echo Return Code = %errorlev%


Hope that fixes it.Great, that worked.

Thanks!You're welcome & again sorry about giving you FALSE INFO to start with.

Good luck
932.

Solve : Help with easy programming project?

Answer»

Hello, my name is Angel, and I'm currently in a class at the UNIVERSITY of Phoenix. This will be my first experience with programming, so I am not very knowledgeable in this subject. (I need how to write a program for dummies) My assignment today is to list the application-level requirements for a currency conversion program
I also need to generate an input-process-output chart for the application.
Also, I need to generate a hierarchy chart.

Can somebody please help me get this INFO down.

thanksWelcome to the CH forums.

Quote

Can somebody please help me get this info down.

As a general PRINCIPLE we do not do HOMEWORK. Suggest you approach your tutor.

Good luck

So the university of Pheonix is real???

I LIVE in Australia and have been recieving SPAM emails weekly from them.

U get me off their mailing list and ill do your homework

933.

Solve : Automated creation and naming folder on the fly by using batch program?

Answer»

Hi all,

I would like to create a batch program to automate file revisioning process. Everytime the batch program is executed, it will have to create a folder which will hold some files. The folder created should be named on the fly eg. ver-1.01, ver-1.02, ver-1.03, etc. That is, it should be able to create the folder by naming it with filename in a specific pattern+incremental numbering as the postfix.

Other than that, once it reaches ver-1.10, the batch program should know that the next folder to create should be named ver-2.01 and the list goes on till folder ver-2.10 is created and then it should create folder ver-3.01 instead of ver-2.11.

Anyone who has done this before or has any idea on how to do it, please help!

Thanks in advance!
Code: [Select]SETLOCAL ENABLEDELAYEDEXPANSION
set /p ver=<ver.txt
for /f "tokens=1-2 delims=." %%A in ("%ver%") do (
set A=%%A
set B=%%B
)
if !B!==08 goto 9
if !B!==09 goto 10
if !B!==10 goto new
set /a B=!B!+1
echo !A!.0!B!>ver.txt
md !A!.0!B!
exit

:new
set /a A=!A!+1
set B="01"
echo !A!.!B!>ver.txt
MD !A!.!B!
exit

:9
rem my computer doesn't think '9' or '10' is a number... :S
set /a b=9
echo !A!.0!B!>ver.txt
md !A!.0!B!
exit


:10
rem my computer doesn't think '9' or '10' is a number... :S
set /a b=10
echo !A!.!B!>ver.txt
md !A!.!B!
exit
You'll have to create a text file called "ver.txt" with the first version you want to implement.
I'm not SURE why it doesn't think that 8+1=9 but i had to make a workaround instead. Let us know if it works.

FBHi

This MAY answer Fireball's query about the problem with numbers 8 and 9.

numbers 0 to 9 are valid "base 10" numbers.

numbers 0x are often considered octal, in which case
numbers 00 to 07 are valid octal numbers,above this the sequence continues 10 to 17.
numbers 08 and 09 have no meaning in octal arithmetic.

My response is triggered by the 7th line of the batch script, i.e.
if !B!==08 goto 9

Regards
Alan
An alternative to misinterpreting numbers as octal and eliminating delayed expansion, would be to combine the left and right DECIMAL as a whole number:

Code: [Select]@echo off
set folder=c:\temp
for /f "tokens=2-3 delims=.-" %%v in ('dir /b /o:-n /a:d %folder%\ver-* 2^>nul') do (
if errorlevel 1 goto first
set digit=%%v
set dec=%%w
goto next
)
:first
md %folder%\ver-1.01
goto :eof

:next
set /a worknum=%digit%%dec%+1
set dec=%worknum:~-2%
if %dec% GTR 10 (
set /a digit=%digit%+1
set dec=01
)

md %folder%\ver-%digit%.%dec%

Be sure to change the folder name in line 2.

Yes, both ways work exactly to what I wanted to do. Thank you guys! Hi ALL,

Based on the SCRIPTS posted by Fireballs and Sidewinder below, what if I want to make the major number of the baseline to increase only by weekly and the minor number will be increased daily and if the script is ran more than once in a same day, the next folder to be created will be the 1st folder created on that day || '-' || x, where x is a running number?

In other words, every week the major number will increase, while daily the minor number will increase if there is any, if there are more than 2 baseline call in a day it will be followed by ‘-‘.

e.g 1/9 Monday baseline is 1.0
2/9 Tuesday baseline is 1.1
4/9 Thursday baseline is 1.2
4/9 Thursday second baseline is 1.2-1
4/9 Thursday third baseline is 1.2-2
8/9 Monday baseline is 2.0

Any help in this will be greatly appreciated. Thanks in advance!i can help but could you start a new topic please?

FBFB is right, start a new topic, and when you do please type echo %DATE% at a command prompt and post the results.

934.

Solve : Novice: How do I control a stepper motor with a rs232 port interface?

Answer»
I have a step motor with rs232 communication.
I know c++ , but programmed only in CLASS years ago, I have no experience with visual basic.
The sw I have is Vstudio 6 with Vbasic and Vc++ student edition from quite a while ago, I don't know if downloading the new express edtions are any better for a novice to work with. For now, I woudl just like to see the freaken motor move lol! Looking for the most vanilla procedure in C++ and/or Visual Basic. I hear VB is easier to use? Any help appreciated.


I want to
Configure Ports
Move motor

Seria Port Settings:
I. configure serial port
•Baud Rate: 38400
•Parity: None
•Data Bits: 8
•Stop Bits: 1
•Flow Control: none


'Here is the command to move motor 500 counts: but how do I pass this command to motor?
II. Send index to motor:
"@0N1_500” & Chr$(13)

I'll get this later but first, I want to see the motor move.
III. loop

‘where 0=address,N=Index Command 500=IndexTravel chr$(13)=carriage rtn

For count = 0 to 4449
‘Set Direct = cw
"@0+” & Chr$(13)

‘Move Motor * Index Number - move motor up position
"@0G1” & Chr$(13)

‘Set Direct = ccw‘
"@0+” & Chr$(13)

‘Move Motor * Index Number – move motor down position
"@0G1” & Chr$(13)

Count = count+1
write (count, pc date & TIME) stamp to text file
Next Count


Brief overview of cammands and a very brief VB code, but I just get errors if I try to perform anything, I don't really know anything much about the structure of VB:

N - Index Number
Format: N#_[value] - where # is the motion profile number 1 or 2
Sample: N1_10000 Index number of profile 1 equals 10000
Description: This command sets the number of pulses to index for the motion profile. This value must
be set before motion begins. These values are saved in the EEProm for stand-alone use.
Range: 0 - 8,388,607


Unit Selection
In order to select a unit the @ command followed by 0 (address of the unit) must be sent.
NOTE: There should be no spaces between the @ and the 0.
How to select the unit:
@0 (Unit is selected)
How to get a response from the unit:
@0$ (Carriage Return)
After the $ command, the pulse generator will return a SMSI30 + the current version number.
Note: In direct talk mode each command is followed by a carriage return.
The unit communicates in half duplex mode, therefore proper setup of hyper terminal is necessary to view characters,
if characters are to be echoed back to the screen.
Instructions
All instructions require that no spaces be sent between the command and the parameter followed by a carriage
return. The commands are also case sensitive and are all sent as capitals.
Command Summary:
A - Acceleration/Deceleration
B - BASE Speed
G - Go (Index)
H - Hard Limit
M - Max Speed
N - Index Number
R - Microstep Resolution
S - Soft Limit
T - Complete Time
V - Verify
+ - Clockwise Direction
- - Counterclockwise Direction
$ - Version Number Register
! - Error Codes Register
% - Verify Controller Address
~ - Set Controller Address




Visual Basic Direct Mode Programming Example
This Example is for Axis=0, and Profile=1
DimConst DefaultTimeout As Single = 0.5
frmMain.MSComm1.Output = "@0A1_100000. & Chr$(13) .Set Acceleration
Pause DefaultTimeout
frmMain.MSComm1.Output = "@0B1_1000. & Chr$(13) .Set Base Speed
Pause DefaultTimeout
frmMain.MSComm1.Output = "@0M1_4000. & Chr$(13) .Set Maximum Speed
Pause DefaultTimeout
frmMain.MSComm1.Output = "@0N1_500. & Chr$(13) .Set Index Number
Pause DefaultTimeout
frmMain.MSComm1.Output = "@0T1_100. & Chr$(13) .Set Complete Time
Pause DefaultTimeout
frmMain.MSComm1.Output = "@0R8. & Chr$(13) .Set Microstep Resolution
Pause DefaultTimeout
frmMain.MSComm1.Output = "@0+. & Chr$(13) .Set Direction CW
Pause DefaultTimeout
frmMain.MSComm1.Output = "@0G1. & Chr$(13) .Start the Index
Pause DefaultTimeout
Wadzilla,
you are making things far to difficult, and you want instant results.
I tried to work with this RS232 communications, but that stuff is enough to drive anyone nuts.
Here are some basics to get things going, but maybe this is not what you want:
-Use VB for programming and Excel for layouts, Binary values etc.
-Download InpOut_32 dll and write a few VB Procs.
-Dissect an old CD drive, it has mostlikely a 3 phase and a 4 phase Bi-Directional stepper motor. The 3 phase is more interesting and more difficult to get the correct Sequences.
-Use LPT1 port and Printer cable and use pin D0 to D7 and pin #25, using InpOut_32 to which you need to pass 4 (step) Binary values for a 4 Phase or 9 (step) Binary values for a 3 phase.
-Search the Internet, after a few 100 pages you will have collected dozens of of sample diagrams, and electronics to buy.
-Be prepared to blow your power supply if you don't send the proper binary values to the LPT1 port, or incorrectly hook-up things.
-For fun you can add an old Analog Joystick to control your treasure (an other dll download is required).

Now, isn't this a giveaway?

The motor is fullt integrated already has a rs-484 interface built in (I have a rs232 to RS485 converter) and it has to run for 600,000 rotations = 800 up/down cycles in a 120 degree environment to pass a reliability test. The Motor also has a language set of 16 commands. I was pretty much told that it has to work with this interface directly to a laptop.. Here is it's user guide:

http://www.anaheimautomation.com/manuals/L010273%20-%2023MDSI%20Series%20Users%20Guide.pdf


Wish I could do it as a leisure hobby but part of a larger project
935.

Solve : Quick Over view of my code for errors please?

Answer»

I believe I have this finished, but I just want to make sure that I didn't make any stupid mistakes that are not easy for me to spot, as I don't really know vbs. thanks for looking and I hope I did everything correctly.

CODE: [Select]Const ForReading = 1

strComputer = "."
i=0
'Set the Path to the source files here.
'It is very important as it will carefully delete inside the windows and program files directories

Set locationPath = ""

'That is the only VARIABLE that needs to be set
Set fso = CreateObject("Scripting.FileSystemObject")
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set f = fso.OpenTextFile("H:\gameLocations\gameList.txt", ForReading)

Do Until f.AtEndOfStream = True
retString = f.ReadLine
fname = Split(retstring, ".")(0)
fext = Split(retString, ".")(1)
sName = Split(retString, ":")(1)
Set colFiles = objWMIService.ExecQuery _
("Select * From CIM_DataFile Where FileName = '" & fname & "'" & " and Extension = " & "'" & fext & "'" & "")
'WScript.Echo "Searching for " & retstring
For Each objFile in colFiles
If InStr(1, objFile.Caption, "c:\windows") > 0 Then
WScript.Echo retstring & " Found In Windows...Carefully Deleting"
'Here is the start of my delete script
searchFileString = locationPath & sName & ".txt"
If fso.FileExists(searchFileString) Then
WScript.Echo searchFileString
Set d = fso.OpenTextFile(searchFileString, ForReading)
Do Until d.AtEndOfStream = True
folderName = d.ReadLine
folderPath = objFile.Path & folderName
strFolder = objFile.Drive & folderPath
fileName = fso.GetFile(strFolder)
WScript.Echo fileName
'fileName.Delete
'Here is the end of my test script.
Loop
Else
Wscript.Echo "File " & searchFileString & " does not exist, skipping"
End If
i=i+1
Else
If InStr(1, objFile.Caption, "c:\program files") > 0 Then
WScript.Echo retstring & " Found In Program Files...Carefully Deleting"
'Here is the start of my delete script
searchFileString = locationPath & sName & ".txt"
If fso.FileExists(searchFileString) Then
WScript.Echo searchFileString
Set d = fso.OpenTextFile(searchFileString, ForReading)
Do Until d.AtEndOfStream = True
folderName = d.ReadLine
folderPath = objFile.Path & folderName
strFolder = objFile.Drive & folderPath
fileName = fso.GetFile(strFolder)
WScript.Echo fileName
'fileName.Delete
'Here is the end of my test script.
Loop
Else
Wscript.Echo "File " & searchFileString & " does not exist, skipping"
End If
i=i+1
Else
WScript.Echo retstring & " Found In " & objFile.Drive & objFile.Path
WScript.Echo "Removing Files/Folder " & objFile.Drive & objFile.Path
strFolder = Left(objFile.Drive & objFile.Path, Len(objFile.Drive & objFile.Path) - 1)
WScript.Echo "Maybe I will code something to delete all the individual files?"
fso.DeleteFolder strFolder, True
End If
End If
Next
Loop
If i > 0 Then
msgbox "Alert!, Found something in the windows directory or the program files." & Chr(13) & Chr(13) & "You might want to reimage the computer to take care of the problem. Should of been taken care of, but there was a chance of possible CORRUPTION of that folder"
Else
msgbox "Success, Computer is clean."
End If
f.Close
Better than any human, the VBScript interpreter will be more than happy to point out your errors.

fso.deletefolder is a powerful and destructive method. Not only will it delete a folder and all it's subfolders, but also the files within. Personally I would temporarily replace that instruction with wscript.echo statements and watch how the file runs.

Only after you're completely satisfied with your results, should fso.deletefolder be activated. FYI, file and folders deleted in VBScript do NOT make a pit stop in the recycle bin. Backing up your system might be prudent.

Good luck.

Not quite sure what the code blocks 'Here is the start of my delete script are doing but when you activate the command 'fileName.Delete, the correct format is fso.DeleteFile filename, Trueit currently has the WScript.Echo in place.

And yes, I do understand that when you delete the file, it goes into oblivion. But this script is going to be used in a major school system and only having to reimage like 1 out of every 15 or 30 computers isn't bad compared to the original plan which was reimage each computerElse
WScript.Echo retstring & " Found In " & objFile.Drive & objFile.Path
WScript.Echo "Removing Files/Folder " & objFile.Drive & objFile.Path
strFolder = Left(objFile.Drive & objFile.Path, Len(objFile.Drive & objFile.Path) - 1)
WScript.Echo "Maybe I will code something to delete all the individual files?"
fso.DeleteFolder strFolder, True


The highlighted line was the one I was referring to.

Quote

But this script is going to be used in a major school system and only having to reimage like 1 out of every 15 or 30 computers isn't bad compared to the original plan which was reimage each computer

If the alternative to the script is a re-imaging, then go for it! If it fails, you do the re-image, tweak the script and move on. If it works you'll be a hero.

Good luck.

Just curious, but aren't there ways to prevent students from installing software on school computers?its not really installing, what they are doing is copying files over, then logging off. Once that is done everybody can play the game, except it can't be deleted as the owner has "changed" according to Novell and the only ones who can delete the files are administrators and most don't have the time to go and clean each computer. So this way, they can log in on an entire lab, run this script and call it a day.

But to make their life more difficult, I am going to ask if they want to SHOW the owner of a file. Now I am running this test

Code: [Select]if (showName == "yes") OR showName == 'y' OR showName == 'Y') Then
WScript.Echo "Yes"
Else If (showName == "no") OR showName == 'n' OR showName == 'N') Then
WScript.Echo "No"
End If

But there is a syntax ERROR and I am not sure. It says like 14 (first line shown) column 15 which is the second = sign. Now I could probably open a new topic, but its the same general concept here. I made a mistake and am not sure what it is.

and that line that you highlighted was from your original code. I left that part intact. I trust that part.At first I thought I was looking at batch code.

Code: [Select]If (showName = "yes" OR showName = "y" OR showName = "Y") Then
WScript.Echo "Yes"
Else If (showName = "no" OR showName = "n" OR showName = "N") Then
WScript.Echo "No"
End If
End If

The code aligns better in an editor than in the forum.
ya i learned, fixed my program on my own and turned it in. Thanks for your help my "boss" i say that loosely was really pleased with how it works. I added a question in the batch that says display file owner and it works like a charm.
936.

Solve : I need one program.?

Answer»

Hi all,

I have a project.

One particular ITEM , If I enter the serial code of this item (input).

I need out put.. In.No, Atno., Location, Inst date, com.date, Photp.

which program i will use?
pls guide me........

joe.Depends where the data (In.No, Atno., Location, Inst date, com.date, Photp) exists. From a DATABASE, try Access. From a spreadsheet try Excel. From a textfile, a simple SCRIPT may do.

Keep in mind that all these technologies may overlap and we would need the overall SCHEME of what your doing in order to ADVISE you better.

937.

Solve : Active directory script?

Answer»

hello, i need a script that will open an active directory users and COMPUTERS mmc. how can i do this?On a SINGLE computer? On a network? What kind of operating system or network environment? Have you attempted to WRITE ONE?

938.

Solve : Batch file - How to process multiple arguments??

Answer»

Hello,

I am trying to write a batch file that TAKES a list of DIRECTORIES as input, compresses each directory using commandline WINZIP and renames the zip files in sequential order.

Problem is, I'm stuck trying to figure out how to even touch the arguments passed to the batch file.

From my research it looks like arguments are TYPICALLY accessed using the %1 - %9 variables, but what if there are more than 9 arguments? Referencing arguments in this manner does not seem scalable, and I still don't know how to iterate from %1 to %2.

How can I write a For loop that effectively says, for each argument that was passed, do (the process), increase the COUNTER by 1 and repeat?

ThanksSomething like this may work. Note you can have more than 9 arguments as each is processed as %1 by using the shift command:

Code: [Select]@echo off
set count=0
:start
if .%1==. goto next
set /a count=%count%+1
.
put your wzzip logic here always processing the %1 variable and using %count% as your sequential number
.
shift
goto start
:next

Hope this helps.
Works great! Thanks for your help.

One other question though-- I have the batch file in C:\Temp. When I drag a few directories onto the batch file, I'd like it to put the output archive files in the same directory as the batch file. Instead the archives are always created in the default DOS directory. What's the best way around this?You can use %~dp0 notation for the wzzip output drive and path. This will result in the drive and path of the batch file itself.

FYI: the resulting drive and path includes a trailing backslash.

Good luck.

939.

Solve : Copier Batch File?

Answer»

Ok, I recently made a batch file to copy files from my hard drive to my flash drive but I need a possible way to save and import a text letter so I only need to put the drive letter in once.

Here are the two .BAT files:


@echo on
title Transfer to
cls
:input32
set INPUT32=
set /P INPUT32=Flash drive letter: %=%
cls
cd C:\Program Files\logger
pause
echo %INPUT32% > C:\dri.txt
copY %INPUT32%:\TaskGather\install\tr.*
start tr.bat
pause
del /F /Q tr.bat
pause
cls

---------------------------------------------------------------------------------------------------------------
Seperate batch file (tr.bat)
---------------------------------------------------------------------------------------------------------------

@echo off
cls
set INPUT32= [Now here is the place I need a way for the batch to READ C:\dri.txt and get the drive letter]
pause
copy Log.txt > %INPUT32%:\TaskGather\records\log.txt
DEL C:\dri.txt
pause
exit

First batch

Quote

@echo off
title Transfer to
cls
:input32
set INPUT32=
set /P INPUT32=Flash drive letter: %=%
cls
cd C:\Program Files\logger
pause
echo %INPUT32% > C:\dri.txt
copY %INPUT32%:\TaskGather\install\tr.*
start tr.bat %input32%
pause
del /F /Q tr.bat
pause
cls

tr.bat

Quote
@echo off
cls
pause
copy Log.txt > %1:\TaskGather\records\log.txt
DEL C:\dri.txt
pause
exit
Thanks man! It should work but I forgot something:
In the first batch in this command line:
Quote
cd C:\Program Files\logger
echo %INPUT32% > C:\dri.txt
copY %INPUT32%:\TaskGather\install\tr.* C:\Program Files\logger
start C:\Program Files\logger\tr.bat %input32%
pause
Ok, the text in the blue is the problem. It won't read Program Files correctly as it needs _ in place of a space. But I can't change it without messing up other programs. Is there a macro (example %time%, %username%) for Program Files that will shorten it?Quote from: HypercamJ on May 04, 2008, 05:32:45 PM
It won't read Program Files correctly as it needs _ in place of a space.

What do you mean? You have a folder called Program_Files? Or you didn't know about quoting paths with SPACES like this "C:\Program Files?" Or you never heard of %ProgramFiles%? Or none of these?


940.

Solve : Manifest file Information?

Answer» MANIFEST’s files are created by DEFAULT during linking in VS 2005.

Is the creation of these mandatory?

These manifest FILE’s are not created in some cases, any ideas what is the REASON for this?

941.

Solve : C++ and Java acquaint?

Answer»

I am starting UNIVERSITY next year and will be doing C++ and Java. Can anyone suggest ways I can get better acquainted with them to GIVE me a head start, and what programs would I write them in as I'm not really sure how it WORKS?

Usually I have just done Visual Basic inside the VB application, but C++ is a universal language and can be used in different APPLICATIONS? Where can I get some? I have tried with Visual C++ but had no idea what I was doing. I am used to just creating an INTERFACE in VB and putting code behind objects.

Thanks. There are tons of free java and c++ tutorials online.

you can download a couple of them and start learning by yourself .

good luck The best thing you can do is look up "object-oriented" on google - that's the key principle for java and c++. type-safety is another big difference from the likes of VB.

942.

Solve : GUI's in C?

Answer»

I am not a noob!!!
I need to know how 2 program GUI's in c as all I can seem 2 do is command prompt programming (by the way i am using DEV C++ Bloodshed as my COMPILER).does that PARTICULAR development tool include the WINDOWS SDK? You'll need that to do GUI programming in Windows...

943.

Solve : Windows programs in "C"?

Answer»

At the moment I'm trying to create some WINDOWS programs in "C"(not C++, clear C). I mean not console applications, but windows programs. Could you recommend me some e-books or other sources that may help me...?www.freecomputerbooks.com



LedioIs there any reason you are limiting yourself to inferior C?Well, I WANT to PRACTICE a little and make at least one serious project before starting with Visual C++I am not a NOOB!
I use C and it works perfectly well; just i can't get GUI's
I use VB6 and it works well. Unfortunately Microsoft thinks otherwise

and I have no choice but to have a GUI! at least without messy hacks...

944.

Solve : Expression Evaluator (what features would YOU want?)?

Answer»

OK first off: The answer IS NOT using the Microsoft ScriptControl! I don't WANT to use that! The goal is a custom built Expression Parser/Evaluator.

Now onto the algorithms. The most common one is called a "recursive descent parser", this is the one I implemented in my Library.

I think you can see where this is going... I'm kind of advertising my own library and I hope it isn't against the rules, but I remember scouring the web for hours in search of this exact thing in my earlier programming days (before I was able to even fathom writing my own), so I thought maybe somebody might like it for their programs. Before you get to excited, it doesn't work with batch programs (although I'll probably add a new command for that or something). Once installed properly (this is the part I need to work on, it has a few dependencies...), however, it will work in VBScript.


In any case, my Parser uses what I think is a neat technique- all it knows about is the parsing, all the knowledge about operators and functions is available through separate plugins, of which I have two kinds: an Evaluation Plugin, which can provide functions and operator support to the library, and a "Core Plugin" which allows for new kinds of formula tokens to be parsed in a custom fashion (for example, this is how I implemented core support for environment variables in %variable% form.

It ALSO features intrinsic support for arrays, using curly brackets, as in {1,2,3}. The Core routines transform this into a call to a Plugin provided function, "Array()", which creates the array and pushes it onto the evaluation stack. However, the most interesting aspect is that it also allows for the use of operators on these lists, as in "{1,6}*{5,12}" being {{5,12},{30,72}}- a List of Lists.


In addition, the Core Plugin provides a HUGE number of functions that almost make the creation of external plugins unnecessary! I'd include a list but frankly I don't think anybody is going to REPLY to this thread anyway.


Does anybody have any suggestions? What kind of thing would you like a expression parser to support? I've managed to implement every idea I can think of! operators? Functions? new syntax? Anything! Interested in ACQUIRING this library for use in one of your programs? I need BETA testers! a programmer shouldn't be testing his own code! It's just WRONG!

I have included a Screenshot to prove this program exists. If you look at the screen shot, you'll notice that the second execute of that entire expression took a little over 0.008 seconds. Not bad, I think. (it is a 1.6Ghz CPU though).

So....


Go ahead and comment on it! If anybody wants I can TRY to package it up but I've had mixed success getting the installer to work consistently.

Thanks for any comments (GOOD, or even bad (I know, I'm weird))!

[recovering space - attachment deleted by admin]Quote

using curly brackets, as in {1,2,3}.

Those are called 'braces.'

I think it's a good project.thanks! I kind of got the algorithms and stuff down pat since I had to write it twice. My first one was just a MODIFICATION of an existing library, but then my working USB drive failed. I still had it and was working of my E:\ backup drive, and went to flash my CD burner's firmware, woops! sent it to the HD! Thankfully since I got to redesign it from scratch I actually KNOW what is going on in the code (most of the time), and I managed to implement something that was impossibly kludged in my first version, plugin-managed operators. Then I found the old library on my Laptops Hard Drive.

There is a problem though, I've simply added too much! I can't keep track of all the "progress points",(what I have to do in separate "domains" of the code) I already have a configuration dialog that shows a tab for each plugin, and loads a Custom Control that that plugin designated it's Settings Page- the dialog itself looks polished, but the controls I made are kind of elementary, almost seem like a tech demo. This project has been in the works for 2 years, and the original one 6 years.

Quote from: Aegis on May 08, 2008, 12:03:24 PM
Quote
using curly brackets, as in {1,2,3}.

Those are called 'braces.'

I think it's a good project.

I had the name on the tip of my fingers as I typed! I couldn't remember the name though, so I just stuck in what they looked like.

One thing that might cause people to avoid it: It's programmed in VB6. I attempted a .NET conversion, but that will have to wait- I've written it twice already.

I think I'll freeze new features until I can iron out the bugs (all known bugs are in GUI code, not surprising to me), and release it with a "calculator" program. At some point I'll use it for it's intended purpose of a graphing program (again my second one- my first versions are always monolithic and full of gross hacks and kludges). That will be interesting, pair the features of the parser with a 3-D Z= graph.
945.

Solve : please HELp me with this project?

Answer»

hi every body
iam a beginner in computer programing & iam so interested in doing such a work
my Quistion is
i found this project online & i would LIKE to get help to know which of PROGRAM do i need to use.& how to do thid work....u can give me example & i'll do the rest of it
please HELPhere it is


Metrics/Checklist for Making Web 2.0 sites:
1)Title, Meta Tags, web url= ie: http://hubpages.com/hub/keyword, content must contain keywords that pertain to each page of the site.
2)Create new username+ password for each site 10 different usernames for every 6-7 keywords per site.
3)Use the Pictures given in the content
4)Give me a list of different usernames and passwords used in the project.
5)Can use the same username for different Web2.0 properties.
6)Web 2.0 properties needed are:
a) www.hubpage.com
b) www.propeller.com
c) www.wordpress.com

7)A) Make sure for every keyword you write a unique title that TIES the keyword to the content. ie: Learn the truth about hair loss treatment for women
Make sure you fill out the profile with some basic information
9) Please use the appropriate pictures(1 of 2) for the appropriate keywords
10)
11) keyword list below
Group 1# Lower Cholesterol= http://www.oneclick-info.com/lowercholesterol
low cholesterol diet
diet to lower cholesterol
foods that lower cholesterol
low cholesterol foods diets
low cholesterol recipes
normal cholesterol levels
cholesterol lowering foods
diet for lowering cholesterol
reducing cholesterol
foods to avoid high cholesterol
how to lower your cholesterol naturally
cholesterol lowering drugs
foods to lower cholesterol
low cholesterol diet menus
diets for high cholesterol
cholesterol lowering
cholesterol free diet
cholesterol reducing foods
low cholesterol food
cholesterol diets
natural ways to lower cholesterol
how to lower bad cholesterol
how to lower high cholesterol
how to naturally lower cholesterol
how to reduce cholesterol
natural cure for high cholesterol

Group 2# Lower triglycerides= http://www.oneclick-info.com/lowertriglycerides
lowering triglycerides
diet to lower triglycerides
how to lower triglyceride levels
reducing triglycerides
diet to reduce triglycerides
triglyceride lowering diet

Group 3# cleanse arteries= http://www.oneclick-info.com/cleansearteries
supplement CLEANS arteries
artery cleaners
artery plaque
hardening of the arteries
clogged arteries
coronary artery disease
blocked arteries
advanced artery solution

Group 4# heart attack prevention= http://www.oneclick-info.com/heartattackprevention
heart attack treatment
silent heart attack symptoms
signs of a heart attack
symptoms of a heart attack
mild heart attack symptoms
early heart attack symptoms
heart attack symptoms in women
10 signs of heart attack
heart attack warning signs
symptoms of heart attack in women
reversing heart disease
heart disease prevention
tips to prevent heart disease




Group 4# stroke prevention= http://www.oneclick-info.com/strokeprevention
signs of a stroke
symptoms of a mini stroke
stroke recovery
mild stroke symptoms
early warning signs of a stroke
stroke treatment
stroke symptons
stroke cause
stroke rehabilitation
symptoms of minor stroke

Group 5# heart natural Lipitor alternative= http://www.oneclick-info.com/naturallipitor
side effects from lipitor
side effects of lipitor
lipitor unusual side effect
generic lipitor
lipitor serious side effects
lipitor generic
Looks like a nasty spam project to me.

946.

Solve : how to view database data in data grid view?

Answer»

Hi everyone,

I am preparing a database APPLICATION in VB.net 2005. I am using Ms ACCESS as database.

I have a problem. I store data in the database by using bindingsource,tableadapter,binding navigator,dataset.

the problem is I can store data in the database but i cannot view the data saved in a datagridview table linked to database.

the datagridview table is in a separate vb form.

Can ANYONE help me. how to view the data after ENTERING(without closing the application).

thanks.Not really understanding the problem. Are you expecting the datagrid to show an updated view of the database after each update? Try opening the connection, do the update, close the connection.

An alternative is run a SQL statement on the an OLEDB data adapter, fill a data table from the adapter and source the datagrid back to the data table. You could hide this logic while the form with the datagrid is loading.




947.

Solve : Creating an interactive menu in JAVA?

Answer»

Hey, I'm trying to create an interactive menu in JAVA and I can't FIGURE out if it's even possible.

Let me first explain what I mean by interactive menu.

I mean that the system will display a list of choices like:

[|] Choice #1
[ ] Choice #2
[ ] Choice #3

Then, the user can use the arrow keys to move the "selection" among the options. So pressing the down arrow key in this CASE would return:

[ ] Choice #1
[|] Choice #2
[ ] Choice #3

Or SOMETHING similar.

Then, when the user has MOVED to the choice they want, they would press enter, and the program would return something associated with the option (say, "1", "2", or "3").

The problem I'm having is that I don't think that I can do this inside the System console/prompt. I'm using Windows and I can create menus that request the user to input what option they want, but not one that's a bit more idiot proof.

Any ideas?

-rock

p.s.
Just to be clear, I'm not using the graphical options with JAVA, I don't know how, and I don't plan on learning very soon. I'm still a beginner at JAVA.Wouldnt it be easier if they entered the number of the choice then have it display back what ever it is?

948.

Solve : NSIS Installer?

Answer»

Im not how into using NSIS are the people here but im having a problem... Im creating a software for a newly developed application and i cant get the background of the software that was given to me to show throughtout the entire installation. It only shows when installing and i dont want that. The script for the Background image is highlighted.

Name "Kurt's Game: Cryptonite: Dual Segas"
Caption "Kurt's Game: Cryptonite: Dual Segas"
Icon "${NSISDIR}\Contrib\Graphics\Icons\nsis1-install.ico"
OutFile "Install.exe"
InstallDir $DESKTOP\Cryptonite
LicenseText "Read Before Continuing!"
LicenseData "TOU.txt"

Page license
Page directory
Page instfiles

UninstPage uninstConfirm
UninstPage instfiles

#Background Image Script Starts Here
XPStyle on

# !define DEBUG
!macro GetReturnValue
!IFDEF DEBUG
POP $R9
StrCmp $R9 success +2
DetailPrint "Error: $R9"
!endif
!macroend

Function .onGUIInit
# the plugins dir is automatically deleted when the installer exits
InitPluginsDir
# LETS extract some bitmaps...
File /oname=$PLUGINSDIR\1.bmp "${NSISDIR}\Contrib\Graphics\Wizard\B.bmp"

!ifdef DEBUG
# turn return values on if in debug mode
BgImage::SetReturn /NOUNLOAD on
!endif

BgImage::SetBg /NOUNLOAD /GRADIENT 0
!insertmacro GetReturnValue
BgImage::AddImage /NOUNLOAD /FILLSCREEN $PLUGINSDIR\1.bmp
!insertmacro GetReturnValue
BgImage::Redraw /NOUNLOAD

FunctionEnd

ShowInstDetails show

Section
BgImage::AddImage /NOUNLOAD $PLUGINSDIR\1.bmp
!insertmacro GetReturnValue
BgImage::Redraw /NOUNLOAD
SectionEnd


ShowInstDetails show

Section
BgImage::AddImage /NOUNLOAD $PLUGINSDIR\1.bmp
!insertmacro GetReturnValue
BgImage::Redraw /NOUNLOAD
SectionEnd

Function .onGUIEnd
# Destroy must not have /NOUNLOAD so NSIS will be able to unload
# and delete BgImage before it exits
BgImage::Destroy
# Destroy doesn't return any value
FunctionEnd



#Splash Screen
Function .onInit
SetOutPath $TEMP
File /oname=spltmp.bmp "my_splash.bmp"

; optional
; File /oname=spltmp.wav "my_splashshit.wav"

advsplash::show 1000 2000 2000 -1 $TEMP\spltmp

Pop $0 ; $0 has '1' if the user closed the splash screen early,
; '0' if everything closed normally, and '-1' if some error occurred.

Delete $TEMP\spltmp.bmp
; Delete $TEMP\spltmp.wav

FunctionEnd

RequestExecutionLevel admin

;--------------------------------

#Installation Section Starts Here

!define MUI_PRODUCT "Cryptonite: Dual Segas"
!define MUI_FILE "SAVEFILE"
!define MUI_VERSION "1.0.0"
!define MUI_BRANDINGTEXT "Cryptonite: Dual Segas"
CRCCheck On

Section "Installation F (required)"

SetOutPath $INSTDIR

SectionIn RO

File Install2.nsi

WriteRegStr HKLM SOFTWARE\NSIS_Cryptonite "Install_Dir" "$INSTDIR"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cryptonite" "DisplayName" "Dual Segas"
WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cryptonite" "UninstallString" '"$INSTDIR\uninstall.exe"'
WriteRegStr HKLM SOFTWARE\Cryptonite\Dual Segas "$INSTDIR"
WriteUninstaller "uninstall.exe"

SectionEnd

; Uninstaller

UninstallText "This will uninstall Segas. Hit next to continue."
UninstallIcon "${NSISDIR}\Contrib\Graphics\Icons\nsis1-uninstall.ico"

Section "Uninstall"

DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cryptonite"
DeleteRegKey HKLM "SOFTWARE\SOFTWARE\Cryptonite\Dual Segas"
Delete "$INSTDIR\install2.nsi"
RMDir /r "$INSTDIR\*.*"
RMDir "$INSTDIR\"

IfFileExists "$INSTDIR" 0 NoErrorMsg
MessageBox MB_OK "Note: $INSTDIR could not be removed!" IDOK 0 ; skipped if file doesn't exist
NoErrorMsg:



SectionEnd

949.

Solve : how to make softwares work on more that 1 system.?

Answer»

hi everyone,

I have a problem. I have created a SOFTWARE with database which STORES information about each incoming and outgoing person from office.

But, I want it to work on many systems in the office.

e.g The name can be entered on GROUND floor or first floor or second floor.

and the information can be accessed from anywhere ,from any system in the office.

Can anyone tell how to make a software networking capable. so that data can be save or accessed from anywhere in the office.

how to do this.

thank in advanceone solution I've employed myself is to have the database app and files located on a network share. This works well with Access(JET) databases, with proper error handling. If your application is handling it's own database file, you'll NEED to FIND a way to handle concurrent accesses.

950.

Solve : Permission Batch file?

Answer» GOOD Day,

I am running windows XP Professional in an active directory environment.
On each computer I have a t:\ drive which is used to allow students and faculty to save there work while the other area of the computers are frozen with a program called deep freeze.

what I would like to do is right script VBS or Batch file that would give the everyone group read and write permission to the t:\ drive.

any one have any advice .

THANKS for your help
Well, you can try use some "hidden" commnads in CMD - I have only ued them once, and that was to set J:\ to be like a ROM drive

I can't remember where I found it....Quote from: Ryder17z on May 14, 2008, 11:03:04 AM
Well, you can try use some "hidden" commnads in CMD - I have only ued them once, and that was to set J:\ to be like a ROM drive

I can't remember where I found it....

That's such a very helpful reply! I've gotten this to work on my computer, but I'm not 100% sure if it is what you want:

Code: [Select]Echo Y| cacls %1 /t /e /c /g %2:F

place in a batch file, and call that batch file like so:

Code: [Select]batch <folder> <username>

in your case would be "everyone".

two reasons I think it doesn't meet your requirements:

- it PROCESSES files, not the entire drive
-it also seems to only work with the files in the ROOT dir (when given a root dir)



I'll use my physic powers: T:[$TEACHERS$], J:[CLASSES], W:[WINOLDAP] and more

was I right? do I win a cookie?