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.

851.

Solve : webcam history?

Answer»

HI first time on here and a rather embaressing problem to begin with.
I was away for work earlier in the week and used my work laptop and webcam to have 'chat' with my WIFE - will the content of that be saved in the computer somewhere? if so is there away i can delete it?
THANKS so much for the help What's the make and model of the webcam, and if it's built in, what's the make and model of the computer? I'm not sure that WEBCAMS save history, but just to make sure. its a dell laptop - not 100% sure of the model
the webcam is not built in - its a micosoft - litecam VX-500
I found no information to suggest a history. ANYWAY, if there was, they probably wouldn't go searching for it.

852.

Solve : SSL programming.?

Answer»

Hey everyone

Okay, I'm trying, for reasons of my own, (those reasons being for my own curiousity to see if i can do it) to connect my ancient HP200LX palmtop to the internet through a serial port on another computer.
I got the connection fine, the palmtop and laptop (through vb.net 2008) were talking perfectly.
The next step was to extend my vb.net program to send the internet into the palmtop upon request.
Or to be more specific, my gmail email account through POP3.
I have been googling for the PAST three days and have put together from about four different tutorials a reasonably stable pop3 email RETRIEVER - except it doesn't WORK on gmail. Gmail uses SSL, which none of the free tutorials on the internet show you how to program.

Does anyone here have any ideas?
Cheers,
Bones

853.

Solve : Remove extension with .bat file?

Answer»

I would like to know to make a .bat file that will remove an extension (eg: .tif) from a file (or many files) that COULD be located anywhere on my computer.

For example:
C:\MyBackups\090809.tif
C:\TEST\090809.tif
D:\Backups\090809.tif

to
C:\MyBackups\090809
C:\TEST\090809
D:\Backups\090809

I would also like this .bat to run each time Windows boots

Is this possible ?

If so, please post exactly what I need to put in my .bat

Thank you !Here's the code. Save it into your startup folder.
@echo off
For /f "tokens=1,2 delims=." %%a in ('dir /b /s *.tif') do ren %%a.%%b %%aQuote from: Helpmeh on September 08, 2009, 06:25:35 PM

Here's the code. Save it into your startup folder.
@echo off
For /f "tokens=1,2 delims=." %%a in ('dir /b /s *.tif') do ren %%a.%%b %%a
the PROBLEM with this is IF (ever) the file names contain more than one dot, the rename will fail. Its better to just get RID of the .gif at the back by substituting or sub-stringing. Thanks for the help Helpmeh, but it did not work.

I created a .txt file in my root drive (C:\). Copied & pasted the code you posted exactly Code: [Select]@echo off
For /f "tokens=1,2 delims=." %%a in ('dir /b /s *.tif') do ren %%a.%%b %%a I then closed the txt file & named it TEST.bat. I kept the .bat in my root drive & created a shortcut directly from it to my Startup folder.
Then I rebooted my computer & saw the .bat run (which btw, took quite awhile - more than 1 min).
I checked a test .tif I MADE to see if the extension had been deleted & it had not. The test .tif file is located in a sub-folder under my root drive & should of been easy to find.
There is only one dot - right before the tif

1. Can this code be adapted for any extension ? For example to remove a .doc extension would it be:Code: [Select]@echo off
For /f "tokens=1,2 delims=." %%a in ('dir /b /s *.doc') do ren %%a.%%b %%a
2. Would it run faster if it knew the directory (folder) the file(s) were in ?

3. Is there a way to make it run invisibly ? (without the DOS window)

Please let me know how to make this work - its been bugging me for awhile now

TIAIs it just me or is there a new line after the ren command. That may be my iPod, but it could cause the problem if that is the case. Try ADDING PAUSE at the end of my script (on a new line) and see what it says when you run it. Thanks for the reply

I'm not sure what you mean by a new line - I don't see one...

I added PAUSE to a new line below the code you gave me. I'm not sure what happened but the DOS screen did not appear. It also did not remove the .tif extension either, so it could of just not run at all.

Can anyone help with my points I made earlier ?To your points, in any order you want: Yes, yes, yes.

Try adding SETLOCAL ENABLEDELAYEDEXPANSION right between @echo off and the for command.
854.

Solve : How to do string stuff on VB?

Answer»

Hi there
I have an array of text such as:
SIZE = 5
array(size,4) as string
array(size,0) = "1H"
array(size,1) = "14D"
array(size,2) = "12H"
array(size,3) = "3H"
array(size,4) = "5H"
and so on

How do i use boolean or anything to CHECK whether this array(i,?) has more than 2 H
How WOULD i write it?

Thank you
Is OK now i have figure it out using substring and counting it

855.

Solve : Interoperability?

Answer»

Okay, I've given up on the SSL encryption aspect and are moving to a more USEFUL point to me.
I'm using my palmtop to control windows commands, such as Alt+tab and things like that, and i have been able to get window handles and titles and USED WM_GETTEXT - but how do I get things like text out of the chat part in wlm? I have VERSION 2009 (build 14.0.8064.206)

856.

Solve : copying a solution file (VB 2008) to flash drive.?

Answer»

I started a class in VB 2008. I am having TROUBLE copying a solution FILE to my flash drive. The ERROR is One or more PROJECTS in the solution file could not be loaded. The project file or web has been moved,renamed or is not on your computer The file has not been moved,renamed and is on my computer.

857.

Solve : Place *.vbs Script under Computer Programming or under Microsoft Dos?

Answer»

Place *.vbs SCRIPT under Computer Programming or under Microsoft Dos ?If you want to use it from the command prompt, use the DOS forum, otherwise treat it as a programming question, is my opinion.
Quote from: Salmon Trout on SEPTEMBER 12, 2009, 08:34:13 AM

If you want to use it from the command prompt, use the DOS forum, otherwise treat it as a programming question, is my opinion.


Any complied program or script can be run from the command prompt.

So, all computer code can be placed in the "Microsoft Dos" section?

Only Batch files should be placed in the "Microsoft Dos" section.

There is often a request for a Batch file and the *.vbs script appears in the "Microsoft Dos" reserved area.Quote
Any complied program or script can be run from the command prompt.

Now that's somewhat silly... you can run word from cmd, but your surely not going to post requests for help with it in the DOS forum.

IMO the fact that we even help with Command Prompt Issues in the DOS forum is leniency; for all intents and purposes questions about the windows shell would go into the windows forum... or perhaps, more appropriate, a subforum?Quote from: BC_Programmer on September 12, 2009, 09:17:46 AM
questions about the windows shell would go into the windows forum... or perhaps, more appropriate, a subforum?

I agree, I've decided. DOS is DOS, and NT family cmd is not DOS. Maybe one should be created? In the interim, I suppose it's a programming matter, especially if it's the kind of thing that could be adapted for e.g. VB6 or VBAQuote from: BC_Programmer on September 12, 2009, 09:17:46 AM

IMO the fact that we even help with Command Prompt Issues in the DOS forum is leniency; for all intents and purposes questions about the windows shell would go into the windows forum... or perhaps, more appropriate, a subforum?

My question is: Should a *.vbs script be used to answer a batch question in the Microsoft Dos section?Quote from: billrich on September 12, 2009, 09:50:16 AM
My question is: Should a *.vbs script be used to answer a batch question in the Microsoft Dos section?

Perhaps, if it offers tangible advantages over a batch solution, or if the DESIRED objective is not attainable in one, No, if its only purpose is to flatter the ego of its poster, or if the poster is a monomaniacal vbs zealot.

that wouldn't be a question at all if the "microsoft DOS" section was for pure DOS RATHER then both pure DOS and command prompt.

However when the Poster is USING windows, that is, cmd, as opposed to pure DOS (where scripting wouldn't be available anyway) then a VBScript solution is acceptable, where a simple batch solution is not easily contrived.

however queries regarding VBScript should be directed to the "programming" forum, since they do not necessarily pertain to the command prompt.if you ask me, i would say totally abolish the section "Microsoft DOS", as it is confusing to many. Why not just a "Batch" or "Scripting" sub section under "Microsoft Windows". If need be, "Microsoft DOS" to be changed to "Pure DOS" (or the likes of it) as in that old dinosaur OS that some people still use today.
858.

Solve : Counting even digits in C++?

Answer»

So I have this project where I'm supposed to count the number of even digits a user inputs using recursive functions, however I don't know what's wrong with my code right now. The function keeps returning 3 digits when you input 2 even digits, and returning 7 when you input 3 even digits. A perfect user is assumed, so there is no need for strings and ARRAYS.


Current code:
Code: [Select]#include <iostream>


using namespace std;

int count = 0;
int number;
int digit;

int evens(int number);

int main(){
cout << "Input number: ";
cin >> number;
cout << evens(number);
return 0;
}


int evens(int number){
digit = number%10; //get last digit
if (number == 0){ //check if end of number and return count
return count;
}
if (digit%2 == 0){ //check if DIVISIBLE by 2
count = count ++; //add to count
evens(number/10); //cut off last digit and repeat
}

evens(number/10);

}how about:

Code: [Select]int evens(int number){

if (number == 0)
return 0; //check if end of number and return count
digit = number%10; //get last digit

if (digit%2 == 0){ //check if divisible by 2
return(1+evens(number/10));
else
return evens(number/10);

}


OVERLOOKING the fact that recursion is a "technique" best avoided (especially for something where an obvious iterative solution is possible) using a Module level variable to determine the results from a recursive function is a bit silly.

Basically, what should happen is-

chop of ones digit.

If even, return 1 added to the even digit count of the number without the ones digit.

otherwise, just return the even digit count of the number w/o the ones digit. (without adding one)

Since this is merely a education exercise, I see no harm in the large number of unnecessary temporary variables.


Also: I MIGHT add that the original cause of your problem was that for even numbers you recursed twice:

as the last line of the function, you have:
Code: [Select]evens(number/10);

which will be executed regardless, even if you had already run it when the if test was true. you might be able to get your version working by placing that particular portion in an else clause. However try running it twice in one program and you'll see a good reason not to use module level variables...

Thanks a lot, I would have use iterations but we had to use recursive functions. I need to go study that chapter again, STILL some things I'm fuzzy on, like EXACTLY how recursive functions (ie this function), would run step by step. :x
Thanks for your help!

859.

Solve : write to a file using web page check boxes as input?

Answer»

I am a rank amateur I have my web page SET up so that the user can use VARIOUS check boxes for meeting lunch menu selection. The submit button returns an error message wrong http verb used error #405 I figure that I need to have some kind of cgi-bin file on the server side. Server is microsoft platform. Can SOMEONE POINT me to a tutorial that will GET me going? Thanks

860.

Solve : good with Turbo C??

Answer» CREATE a C program that will ask a USER a STRING and a letter input. Then the program will receive the occurances of the letter in the string entered,then reverses the string.
Enter a WORD: hello
Enter a letter: o
*censored*
lleh
guys please help me with this one!!!! using loop and if.What do you have, so far?
861.

Solve : Visual Basic 2008 Express?

Answer»

I'm a complete beginner on VB and I'm making my first little program.

I have made a menu strip along the top and I would like to know how to configure the

Open
Save
Exit

Copy
Paste

Help

buttons as the book I'm using doesn't explain how to.

Any help please?Are you asking how to change the appearance of the menu or do you want to know how to add functionality to each menu item?How to add the functionality. I have already added the buttons.I'm not sure about the newer versions... haven't messed about with them enough- but in VB6 you click the menu and the menu item, and it will show the code procedure for that menu.

...

EDIT: I checked in Visual Studio 2008- after you add the menu items, you double-click the item whose code you want to see to view the procedure.Yeah, you double click to add the code, but all I have written in the code at the moment is:

Quote

Private Sub OpenToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles OpenToolStripMenuItem.Click

MsgBox("This would open a new file", MsgBoxStyle.Information)

End Sub

How would I add the functionality to these buttons?
you write the appropriate code there...


what exactly will it "open"?

First of all, the save button would save the text in the INPUT field.

Then the Open button would open the text into the Input field.

I'm thinking of using either .txt file extension or even a completely new one.I usually use StreamWriter/Reader for reading FILES:
Add the OpenFileDialog component from the toolbar to the form and name it "diaOpenFile"

Under the properties of "diaOpenFile" set the Filter property to:
Text File|*.txt
You can edit this later to set it for any file extension you want.

Add this to the top of your code:
Code: [Select]Imports System
Imports System.IO
I'll bring up the rest, just need to find the code.Ok, found the rest of the code.

Add this to the top of your code:
Code: [Select]Dim objFileRead as StreamReader
Asumming you only have one textbox and are saving to one line of the file add this inside the Open Click Event that you PROVIDED earlier:
Code: [Select]Dim intDialogResult As INTEGER
Dim strOpenFile As String

intDialogResult = diaOpenFile.ShowDialog()
strOpenFile = diaOpenFile.FileName()

If intDialogResult = 1 And strOpenFile <> " " And File.Exists(strOpenFile) = True Then
objFileRead = New StreamReader(strOpenFile)
ReadFile()
End If

Then for the ReadFile() Sub, type this:

Code: [Select]Sub ReadFile()

Dim strTempString As String
Dim intLineNum As Integer = 1

Do Until objFileRead.EndOfStream = True
strTempString = objFileRead.ReadLine()
Select Case intLineNum
Case 1
txtTextbox.text = strTempString
End Select
strTempString = " "
intLineNum += 1
Loop

objFileRead.Close()
End Sub
You can add any amount of Cases for how many lines there are in the text file to read and how many textboxes to fill.

862.

Solve : VB and Delphi help?

Answer»

Hello everybody

I am just a starter in programming

I have a code here, I think it is VB code

Code: [Select]Private Sub Form_KeyDown(KeyCode As INTEGER , Shift As Integer)
If KeyCode = vbKeyF Then End
End Sub

1. What does this code do?
2. Please give me a code does the same work in delphi

THANKE YOU This seems to be incomplete code, now if it had an END IF with it, then it would end the program.Hello

Thank you M.r macdad-

someone told me that it will do a command when I press F and here it will end it self

well, can you give me a code in delphi can do that?

ThanksmacDad- that IS complete code. a One line if statement doesn't have an end if.

When you press F, the program will end.

THANKS for the correction BC, didn't know that end if isn't required for one-lined If statements.Hello

ok GUYS thank you, what about delphi code


Hello!

This line open Acrobat Reader program.

Dim iResult As Double
Dim iPath As String
iPath = "C:\Program FIles\Adobe\Acrobat 7.0\Reader\AcroRd32.exe "
iResult = Shell(iPath, vbMaximizedFocus)

Where possible insert line, that program open optional access path.

pl: w:\MyPdf\demo.pdf

ThanksPlease post to a seperate thread.Hello!

If press command button, open AdobeReader program.

Private Sub Command10_Click()

Dim iResult As Double
Dim iPath As String
iPath = "C:\Program FIles\Adobe\Acrobat 7.0\Reader\AcroRd32.exe "
iResult = Shell(iPath, vbMaximizedFocus)

End Sub

All ok.

But I LIKE, the program not open Library "c:\Documents", open my optional Library, example "w:\MyPDF"

Thanks

863.

Solve : Microsoft VB (Word 2003)?

Answer»

I'm working with MSWord2003's vb and I was wondering how I could change a label's colour depending on how high a slider is set, 100 to deep red, 0 to green, and fade between them (50 is some kind of red/green colour).more details please.
it's VBA, by the way.

In either case you'd probably simply handle an event on the slider; LIKELY "Change".

by doing so you can use the Slider's "Value" to DETERMINE the percentage of red and green.Quote from: BC_Programmer on September 21, 2009, 12:59:30 AM

it's VBA, by the way.

In either case you'd probably simply handle an event on the slider; likely "Change".

by doing so you can use the Slider's "Value" to determine the percentage of red and green.
Manually? It's out of 100. Is there a way that uses the value to create a colour CODE?

And it's Microsoft Visual Basic. PRESS alt+f11 and see. Quote
And it's Microsoft Visual Basic. Press alt+f11 and see.

No. It isn't. It's Visual Basic for Applications.


Just because it says "Microsoft Visual Basic" in the title-bar for the Visual Basic editor doesn't mean a thing.

I, unlike you, know the history of both VB and VBA, as well as the macro languages that came before it. Visual Basic is a separate product entirely, and is part of Visual Studio, not Microsoft Office.

Quote
Manually? It's out of 100. Is there a way that uses the value to create a colour code?
yes. it's called basic arithmetic.

Combining red and green?yes. basic arithmetic.

recall the RGB function takes a Red,Green, and a blue value and returns a packed 32-bit integer, which you can use when setting the color of a control.

the idea is to MAKE the red and green based on the slider position.

assuming red is 0 and green is 100.

Code: [Select]Red = (Slider.Value/100)*255
Green = 255-Red

and then you use those two in a RGB function.


864.

Solve : File/String manipulation, C++?

Answer»

I have been hunting around, but not yet found a way to do this...

Warning: Much stuff Below this line!
--------------------------------------------------------------------------------------

Before we begin, I'm using Dev C++ 4.9

Here is how it's supposed to work:

Code: [Select]#include <iostream>
#include <windows.h>
/* Sometimes mingw (part of Dev C++) doesn't include this file, however it might be useful...
*/
#include <stdio.h>
#include <fstream>
#include <string>

int main()
{
new filestr[128]; // String, containing the filename or the path to it, like: C:\myfolder\myfile.txt
new str[96]; // Main data string

printf("Specify the file to open:\n");
cin >> filestr;
/* By default, the TXT extension will be added to filestr
Trying to open filestr.txt

if that file doesn't exist, do this:
Try opening filestr.map
if that file doesn't exist, do this:
Try opening filestr
if that file doesn't exist, do this:
list all files found with similar name, Example: 133.txt, 133.log, 133.inf, 133.ini, 133.map
and let the user choose which one to open

if no files are found, an error message would SHOW: "Error: File doesn't exist!"
else, we just continue:
*/
fstream file;
ofstream FILE;
FILE.open(filestr);
/* Here we begin messing with the text
if the opened file contains any of these, we proceed, else this would appear:"\nError: File Not Useble!\n"

The usual:
AddStaticVehicleEx(modelid, x, y, z, a, colorA, colorB, delay);
Would be changed into:
Vehicle[£] = AddStaticVehicleEx(modelid, x, y, z, a, colorA, colorB, delay);

Or The messy one:

<object name="test">
<position>x y z</position>
<rotation>rX rY rZ</rotation>
<model>OBJ_model</model>
</object>

NOTE: The numbers can be within these ranges:
Name: This is used as a name and/or description FIELD
Position: 3 float variables, raging from -3000 to 3000, example: 2000.1 & 2991.06 & -1200.78
Rotation: 3 float variables, I don't know the range, it's counted in radians
Model: OBJ_model, raging from 1 to 70000

However that block or WHATEVER we should name it, would turn into this:

We start by converting rX, rY and rZ:
rX = RadiansToDegrees(rX);
rY = RadiansToDegrees(rY);
rZ = RadiansToDegrees(rZ);

Note: RadiansToDegrees doesn't exist, I would create it if I knew how to convert between radians and degrees

if name is object or object(int) , we do this:
"Object[@] = CreateObject(modelid, x, y, z, rX, rY, rZ); // name\n";
else we do this:
first we check if 'name' contains spaces and REPLACE them with '_' (underline/underscore)
Then we do:
"name = CreateObject(modelid, x, y, z, rX, rY, rZ);\n";

Now lets continue, this was just the half of it :)
*/
printf("Should the file be saved as a PWN file?");
/* Here we ask the user if he/she want's to save the file as filestr.pwn instead of filestr with it's original
extension.
However, if the user opens a PWN file, it ins't neccesarry to ask about it, so we skip that question and
save the file later as filestr.pwn

if the user chooses yes, we do this: (Applies when asked if save as PWN)
FILE << "#include <a_samp>\n\n"; // This is supposed to be on the first line in the file we write to
*/

// Now lets continue..

int obj_count;
int veh_count;

FILE << "new Vehicle[£] :\n";
FILE << "new Object[@] :\n";

FILE << "// Vehicles:\n";
for(veh_count < £; veh_count++; veh_count = 0){
FILE << "Vehicle[£] = AddStaticVehicleEx(modelid, x, y, z, a, colorA, colorB, delay);\n";
}
FILE << "// Objects:\n";
for(obj_count < £; obj_count++; obj_count = 0){
FILE << "Object[@] = CreateObject(modelid, x, y, z, rX, rY, rZ;\n";
}
cout >> "Vehicles: " >> veh_count << endl;
cout >> "Objects: " >> obj_count << endl;
FILE.close();
printf("\n\nSuccess!");
}

£ means a number which starts from 0 (zero) and increases with each instance of AddStaticVehicleEx()
@ means a number which starts from 0 (zero) and increases with each instance of CreateObject()

Notes:

This should not be case sensitive when reading files

The code isn't supposed to write the same line twice, even if it kinda LOOKS that way


Help would be appreciated, as I'm not getting anywhere myself Quote from: Ryder17z on September 23, 2009, 05:04:10 PM

Note: RadiansToDegrees doesn't exist, I would create it if I knew how to convert between radians and degrees

A small contribution:

A circle is 2*pi radians, therefore a half circle is pi radians. So you should be able to easily see that degrees = radians * 180/pi.

It may help to think of a radian as being the angle of an arc created by wrapping the radius of a circle around its circumference.

865.

Solve : Certain email attachments are unreadable?

Answer»

Hello,
This is my first posting so I hope I do it right? I have an HP LAPTOP with Vista. My Operating system is Internet Explorer with Window's 7. My email is program is Road Runner. I am experiencing a PROBLEM with certain email attachments being unreadable when opened. It is a mix up of all different characters comprised of letters & numbers. There are some readable portions but the message cannot be printed out in the same form that it was sent to me. The message always says WORDPAD in the header.
Other computers RECEIVE the same email and have no problems. I have been trying to uninstall WORDPAD in hope that I could reinstall it & perhaps solve my problem but I have not been able to do so. I would be very THANKFUL for any assistance in this matter. Thank you
I don't think WORDPAD is the issue. POST the attachments here and we can see.

866.

Solve : software masking?

Answer»

i want to CREATE a software which WOULD Hide my "Packing and unpacking software" while processing that softwareWhat do you MEAN by "packing and upacking" software?

Are you TRYING to hide your compression WORK? If so, why?

867.

Solve : VB2008?

Answer»

I am using VB 2008. I have a text box that a PERSON WOULD enter their name. My instructor WANTS that name to end up in a label also. I have looked and can't find a way to do that. Can someone help me?mylabel.text = yourtextbox.text

868.

Solve : Visual Basic 2008?

Answer»

Hi FOLKS

I have about 52 image FILES in a folder call resources and as you would want to know, i am making a card game.
I want to write a short code to LOAD all images to an array by using some statement but the problem is that i also need to use the image file name to work with some logic.

For examples:
I have an image called 2H, 3H, 4H, 8C, 9C, AS and so on
Having to know that 2H is 2 of hearts and AS is Ace of spade
I called these files on purpose so i can use numbers and string easily, while working with substring.

So i am looking to get something like this, if it is helpful

For i = 0 to 51
image(i) = image.fromfile(directory)
next

the next things is that i want to use image(i) file name for some other uses
like
image(i).filename.substring(0,1)

Obviously you cant do it with this code but i would like to know WHETHER there is another method

Please Help
Thank YouIs ok now i have SORT it out

Dim dir As New IO.DirectoryInfo("C:\")
Dim fFile As IO.FileInfo
Dim counter As Integer = 0
For Each fFile In dir.GetFiles("*.JPG")
resCards(counter) = Image.FromFile(fFile.FullName)
cards(counter) = fFile.Name
counter += 1
Next

869.

Solve : DarkGDK help...?

Answer»

This should display 100 different words (only two distinct word right now), and for each word, wait for the user to press the up or down arrow key. If they press up, say "You Won.", if they press down, say "You Fail.", and either way increase a variable which INDICATES which word to print. Oh, and, if within 5 seconds, no key is pressed, then go on to the next word. It works nothing like it should. PLEASE help me! Oh, and it is written in DarkGDK on Visual C++ 2008 Express.
Code: [Select]#include "DarkGDK.h"
#define NO_KEY 0
#define DOWN_KEY 1
#define UP_KEY 2

int iTextIndex = 0;
int iMilliTime = 0;
bool failed = false;
bool won = false;

int getPressedKey();
bool RUNNING();
void noKeyPressed();
void upKeyPressed();
void downKeyPressed();
void partOne();
void PARTTWO();

void DarkGDK()
{
while (iTextIndex <= 100)
{
while (running())
{
if (dbEscapeKey())
return;
partOne();
}
}
}

int getPressedKey()
{
if (dbUpKey())
return UP_KEY;
if (dbDownKey())
return DOWN_KEY;
else return NO_KEY;
}

void noKeyPressed()
{
iMilliTime ++;
dbSleep(1);
switch(iTextIndex)
{
case 0:
dbText(64, 64, "House");
dbSync();
case 1:
dbText(64, 64, "Cat");
dbSync();
DEFAULT:
dbText(64, 64, ".");
dbSync();
}
return;
}

void success()
{
iTextIndex ++;
dbCLS();
dbText(64, 64, "You Won.");
dbSync();
dbWait(5000);
dbCLS();
iMilliTime = 0;
return;
}

void failure()
{
iTextIndex ++;
dbText(64, 64, "You Fail.");
dbSync();
dbWait(5000);
dbCLS();
iMilliTime = 0;
return;
}

void partOne()
{
switch(getPressedKey())
{
case NO_KEY:
noKeyPressed();
case UP_KEY:
success();
case DOWN_KEY:
failure();
}
}

bool running()
{
if (iMilliTime <= 3000)
return true;
else
return false;
}

Also, please don't flame me, I know it is probably a very simple/stupid problem.
I am still young to be doing stuff like this.

870.

Solve : Noobish VBA Query?

Answer»

Hi all,
GOT a VBA question for you. As the subject name suggests, im pretty new to VB, hence why I need some help!

At the moment Ive got a program/form that will search and bring up a list of files stored on a network file directory. The list is displayed in a list box, with the main part of the file name displayed in the left hand column and then the full file name in the right hand column.

What Im trying to do is to create a third column that will display the Date Created for the files, and then ANOTHER BUTTON that will order the files by the Date Created.

As you may suspect someone else wrote the code that search's for the files and Im just trying to add a little more functionality to the program as they've left.

Im just after the code that basically gets the Date Created and PRINTS it in a third column for each of the files. Can post any additional info if needed.

Cheers!
mufwell thanks all

Quote from: midgetunderfire on October 02, 2009, 03:28:55 AM

well thanks all



You're welcome.
871.

Solve : VB-6 Application_MSFlexigrid or DBGrid?

Answer»

Sir,
I have made a VB-6 application in which it dispalys data of my class students in Msflexigrid. In its DESIGNING, I have defined column WIDTH as PER my requirement such as less width for Roll No but more wide for Name field. My problem is that MsFlexigrid does not allow mouse scrolling like in excel sheet to move up or down through mouse. It does not allow on screen editing too.
When I made same application in DBGrid enabling on screen edit/modify facility but this does not allow me to fix column width as per my requirement as it is possible in MSFlexigrid.
Please help me in
1. Mouse scroll facility in either in DBGrid or MS flexigrid
2. If it is DBGrid, how can I fix Column width.

Lohani

Neither- I recommend using SGrid

http://www.vbaccelerator.com/home/VB/Code/Controls/S_Grid/article.asp

or EVEN better:

http://www.vbaccelerator.com/home/VB/Code/Controls/S_Grid_2/S_Grid_2/article.asp


OR- instead of using DBGrid use the Microsoft DataGrid Control, if possible. (this requires Visual Basic Professional or Enterprise, though)

872.

Solve : animation?

Answer»

My instructor wants us to animate a picture in VB 2008. He didn't tell us how to do it. It is not in my book either. I googled how to animate but most of the sites are over my HEAD since I just started my class. Can anyone tell me a simple way to animate an object?So this is homework? We can't help you. Study how animation is done and then you will understand how to do it in VB2008. It involves creating a sequence of pictures, each slightly different from the ONES before and after, so that when they are viewed rapidly in sequence it seems like one moving picture. Perhaps you could create a simple image of a bouncing ball USING equations of motion.

When I see questions like this; I think that the questioner must be in the wrong class because the teacher is assuming a certain level of KNOWLEDGE and understanding in the STUDENTS. If the teacher is wrong, then he is a poor teacher. If the teacher is correct, then the student does not have the right abilities for the class.

The whole point of programming is that you first think about the problem to be solved and work out how it must be done. It won't be in the book. If your next step is to ask on a web forum, maybe you should take a different class?


Thanks for your advice. My instructor never explained how animation worked. I googled how animation worked. I have a couple of ways to do it now.

873.

Solve : GW-Basic without 60k memory restriction?

Answer»

Anyone know of an alternative to GW-Basic (Line Number Programming) that is not restricted to maximum program memory size of 60k, that is still same language with line numbers used?

Generally 60k is plenty, but lets just say there is a ton of IF statements that eat it up.. ha ha

I should probably rewrite the old program in a newer language like C++ etc, but figured i'd check before recoding all of this. This is a project I had 25 years ago with a game and now at the last 3/4 of the programming I realized crap... even though system has 1.5 GB Ram it can only address 60k of it which is a joke...lol

Would be nice if I can import the game.bas file I have into a newer interpreter that allows for same syntax with line numbers without 60k limit to be able to finish this project.

Found all my work up until about 1991 on a 10MB IDE Hard Drive in an old box of old Tandy manuals etc. Was able to grab all 10MB off drive and play with the small files including GW-basic copyright 1987 version 3.22 as seen in screenshot below.

[attachment deleted by admin]You should use QASIC.EXE which is very close to the same syntax.
Plus has some extra features.
It is on the Windows 98 CD.
Or oogle it and find where you can get a copy FREE. The QuickBasic Interpreter allows for progs up to 160k before the need to use other commands which can increase that considerably. QuickBasic 4.5 is reckoned to be the best release, it's also the last release. Programs written in GWBasic will very often run in the QuickBasic 4.5 IDE without change.

Although there is no need for line numbering in QuickBasic line numbers are acceptable and can be used with the horror-of-horrors instruction GoTo..

Good luck.

Quote from: Dusty on October 04, 2009, 12:52:27 AM

The QuickBasic Interpreter allows for progs up to 160k before the need to use other commands which can increase that considerably. QuickBasic 4.5 is reckoned to be the best release, it's also the last release.


QuickBasic Professional Development System 7.1 was actually the last release, and IMO was the best, simply because it's so much more powerful then QB 4.5. In fact, it's the same as Visual Basic for DOS, without the ability to create forms.


QBASIC however would be an excellent alternative.I like QB 4.5 and still use it.
Here is a site that claisms to have both versions BC mentions.
http://www.qbcafe.net/qbc/english/download/compiler/qbasic_compiler.shtml
I have not tried that site.
If it works for you, please lets us know.Quote from: BC_P
QuickBasic Professional Development System 7.1 was actually the last release

Basic PDS 7.1 is not Quickbasic, despite some sites claiming to have QuickBasic 7.1 for download, or is it? Even the prestigious QuickBasic Cafe site (here) mentions QuickBasic Compilers then goes on to specify QBasic 4.5 and QBasic 7.1. One redeeming factor is that their download files are named QB45.zip and PDS71.exe...

Why do I believe everything I read on the Net?
Quote
Microsoft QuickBASIC (also QB or incorrectly, "QBasic", which is a different system)..... The last version of QuickBASIC was version 4.5 (1988), although development of the Microsoft BASIC Professional Development System (PDS) continued until its last release of version 7.1 in October 1990
from Wiki

Other refs here..

Basic PDS 7.x was also known as QuickBasic Extended (QBX) but never, to my knowledge, QuickBasic 7.x.

Yes. it is Quickbasic. It says so right in the help files.

In the topic, "QBX Memory and Capacity":

QBX Memory and Capacity

This section explains the FACTORS that affect and control memory management in the quickBASIC Extended (QBX) environment:

...

It also mentions it during a brief overview of command shortcuts, it compares shortcuts as used in "QuickBASIC" to those used in epsilon and brief.

I also find it strange that, if it really was a separate product, how it managed to get to version 7.1, not to mention the naming of the executable, qbx.exe.

I might also add that the naming of the ZIP's themselves are irrelevant. the distribution media was floppy, not ZIP, so any naming convention established for the ZIP files was done purely at the whim of the person who created the zip file.


Additionally, and as an interesting note at least, is that the differences between QBX and QB45, while useful and quite dramatic, are nothing compared to the difference between QuickBasic 4.5 and it's previous version, 3.0; the syntax- even the very core of the language- the identifiers, were completely changed. However QB 2.0 and 3.0 were very... odd... in that they required quite an amount of odd constructs. In that sense does this not make QuickBasic 4.5 Not actually quickbasic but rather a deviant that was mislabelled with the same name? Is QB4.5 REALLY "BASIC PDS" version 4.5?


Another interesting note is that QBX is written from the same codebase, which means that, regardless of the label given by it's creators, it's still a version of QuickBASIC, much in the same way you can paint a rock, but it's still a rock.
What is the version number of the run time library? That should give a clue.
Anyway, any version of the Microsoft QB from 4.0 on is a good choice for anybody who wants a replacement for GW-Basic.
If you only want the interpreter., use the QBASIC from windowds 98.
hmm, OK, how about this.

being pedantic, it is only colloquially known as QuickBASIC... however, the QB in QBX.EXE really must stand for something, and of course the version number states 7.1, which in this case implies there are previous versions.


I might CONCEDE in the case where the QBX environment was a blatant departure from QB4.5, however- it contains all the same features of QB4.5 with added features, it can reference the same libraries, etc.

Additionally, any QB 4.5 program can run in QBX- this is more then can be said even of the so called "Visual Basic" that is called "Visual Basic .NET" which even with the assistance of the migration wizard can barely manage to get even trivial VB6 applications running in the .NET environment.... However that is a completely different blathering! Quote
can barely manage to get even trivial VB6 applications running in the .NET environment.... However that is a completely different blathering! Tongue
Yes... Le's not go there! He wants a replacement for GW-BASIC that can use more memory. Most of the early versions of QB or QBASIC or whatever the called it would do.

I would not recommend a newer version that has been extended. Just something simple can can run the GW BASIC programs.Quote from: Geek-9pm on October 05, 2009, 10:43:02 AM
Yes... Le's not go there! He wants a replacement for GW-BASIC that can use more memory. Most of the early versions of QB or QBASIC or whatever the called it would do.

I would not recommend a newer version that has been extended. Just something simple can can run the GW BASIC programs.

Additionally, downloading either QB 4.5 OR QBX is pirating.

QBASIC, however, is free.Quote from: BC_Programmer on October 05, 2009, 10:49:09 AM
Additionally, downloading either QB 4.5 OR QBX is pirating.

And VB for DOS too... even though these are often called "abandonware", they are Microsoft copyright material and as BC says, sites hosting it are committing piracy.

FreeBasic is very QB COMPATIBLE, and as the name implies, free...

http://www.freebasic.net/

Turbo Pascal is genuinely "abandoned", in that Borland have made versions 1.0, 3.02 and 5.5 for MS-DOS free and legal to download and distribute.

http://downloads.ziddu.com/downloadfile/1549475/tp55.zip.html

I don't know about the TP IDE but the QB ones have a well known horrendous drawback in NT family OSs - Windows NT4, 2000 and later, which is that as soon as you start the IDE your cpu usage will shoot up to 100% due to the way MS-DOS programs wait for a keypress. You can control it with a (payware) util called Tame, but it is a big nuisance. On my Shuttle P4 the cpu temp would RISE and cause the fan speed to noisily ramp up to max rpm, so I would prefer FreeBasic for that type of



874.

Solve : how to read a file having more then one EOS?

Answer»

Hi guys,

I have a problem, I make a program in c in which i write a s.txt text file having all the character VALUE from 1 to 256.
then i read the file and TRY to print all the values in another file, but character number 26 is EOS HENCE it breaks at that point.
Now i want to read the file till 256 characters. Could some one please help me to solve my issue.
program is as follows:
Code: [Select]#include<stdio.h>
#include<stdlib.h>
int main()
{
int ch,ch1;
int i=0,j=0,k=0,i1;
FILE *fp,*fs;
fp=fopen("s.txt","w");
for(i1=0;i1<256;i1++)
{
FPRINTF(fp,"%c",i1);
}
fclose(fp);
fp=fopen("s.txt","r");
fs=fopen("ss.txt","w");
while(1)
{
ch=(int)(fgetc(fp));
if(ch==EOF && j>=1)
{
fprintf(fs,"%d. %d %c\n",i,ch,ch);
break;
}
else if(ch==EOF && j<1)
{
fprintf(fs,"%d. %d %c\n",i,26,26);
j++;
i++;
ch=27;
}
else
{
fprintf(fs,"%d. %d %c\n",i,ch,ch);
i++;
}
}
fclose(fs);
fclose(fp);

}
thanks in advanceI have tried something else
Code: [Select]#include<stdio.h>
#include<stdlib.h>
int main()
{
int ch;
int i=0,j=0,k=0,i1;
char BUFFER[257],ch1;
FILE *fp,*fs;
fp=fopen("s.txt","w");
for(i1=0;i1<256;i1++)
{
fprintf(fp,"%c",i1);
}
fclose(fp);
fp=fopen("s.txt","r");
fs=fopen("ss.txt","w");
for( i=0;i < 256; i++ )
{
ch1=(fgetc(fp));
buffer[i] = ch1;
if(i==26)
{
fprintf(fs,"%d. %d %c\n",i,ch1,26);
}
else
{
ch = (int)ch1;
fprintf(fs,"%d. %d %c\n",i,ch,ch1);
}
}
fclose(fs);
fclose(fp);
return 0;
}
but after getting EOL at 26 it prints EOS till 256 plz help to solve.futher something improved but still after 26 it read and prints EOS.
Code: [Select]#include<stdio.h>
#include<stdlib.h>
int main()
{
int ch;
int i=0,j=0,k=0,i1;
char buffer[257],ch1;
FILE *fp,*fs;
fp=fopen("s.txt","w");
for(i1=0;i1<256;i1++)
{
fprintf(fp,"%c",i1);
}
fclose(fp);
fp=fopen("s.txt","r");
k = sizeof(fp);
printf("%d\n", k);
fs=fopen("ss.txt","w");
for( i=0;i < 256; i++ )
{
if(i==26)
{
fprintf(fs,"%d. %d %c\n",i,26,26);
}
else
{
ch1=(getc(fp));
buffer[i] = ch1;
ch = (int)ch1;
fprintf(fs,"%d. %d %c\n",i,ch,ch1);
}
fprintf(fs,"%c\n",buffer[i]);
}

fclose(fs);
fclose(fp);
return 0;
}I got the solution :

#include
#include
int main()
{
int ch;
int i=0,j=0,k=0,i1;
FILE *fp,*fs;
fp=fopen("s.txt","w");
for(i1=0;i1<256;i1++)
{
fprintf(fp,"%c",i1);
}
fclose(fp);
fp=fopen("s.txt","rb");
fs=fopen("ss.txt","wb");
while(!feof(fp))
{
ch=(int)(fgetc(fp));
fprintf(fs,"%d. %d %c\n",i,ch,ch);
i++;
}
fclose(fs);
fclose(fp);
return 0;
}

875.

Solve : how to decode dll???

Answer»

i had BUILD a DLL in [emailprotected] where i had WRITTEN my entire code, connection establishments to database. now as i changed my machine i'm unable to CONNECT to database. so i want to chage the connection strings and change in code in dll. so how can i decode the dll and get my code and change it??
Usually you just open the project/source file for the DLL you BUILT, edit it and rebuild.

What type of database is this?

What programming language?its ".pdb" file in C# language and the database is sql server 2000..a "pdb" file is useless for anything but debugging the file.

So, what happened? did you just happen to forget where you put the source code? Why was the connection string NOT made configurable, anyway?

876.

Solve : why won't my if-else statement work??

Answer»

#include
#define p printf
#define s scanf
int year, month, age, currentdate, currentmonth, birthmonth, birthdate,
numofmonths, daysalive;
main ()
{
p("Welcome to my age calculating program!\n");
p("The program will CALCULATE the number of days you have live since birth.\n");
p("Note: The result will not be EXACT because of leap years.\n");
p("Input age: ", age);
s("%d;", &age);
{
for (currentmonth = 1;
currentmonth <= 12;
currentmonth++)

p("%d \n", currentmonth);

}
p("Input current month: ", currentmonth);
s("%d;", &currentmonth);
p("Input current date: ", currentdate);
s("%d", &currentdate);
p("Input birth month: ", birthmonth);
s("%d", &birthmonth);
p("Input birth date: ", birthdate);
s("%d", &birthdate);
if (currentmonth >= birthmonth);
{
daysalive = (age * 365) + (currentmonth - birthmonth) * 30 + (30 - birthdate) + currentdate;
p("The number of days you have lived is about %d", daysalive);
s("%d", daysalive);
}
else
(currentmonth <= birthmonth);
{
daysalive = (age * 365) + (12 - birthmonth) * 30 + (currentmonth * 30) + (30 - birthdate) + currentdate;
p("The number of days you have lived is about %d", daysalive);
s("%d", daysalive);
}
}

I checked everything, still it has errors.
It says: Error: expected primary-expression before "else''
Error: expected ';' before "else"

Could you please help? That's my only problem. I need it to work, as in both conditions.
are you supposed to have ; at the end of an if statement? (if (9 = x) { not if (9= x); {)QUOTE from: itburnswhenipee on October 10, 2009, 11:48:24 AM

are you supposed to have ; at the end of an if statement? (if (9 = x) { not if (9= x); {)

No.

What language? Quote from: Geek-9pm on October 10, 2009, 01:30:55 PM
What language?

Sort of looks like C I think

Code: [Select]#include <stdio.h>
Code: [Select]#include <stdio.h>
#define p printf
#define s scanf
int year, month, age, currentdate, currentmonth, birthmonth, birthdate,
numofmonths, daysalive;
main ()
{
p("Welcome to my age calculating program!\n");
p("The program will calculate the number of days you have live since birth.\n");
p("Note: The result will not be exact because of leap years.\n");
p("Input age: ", age);
s("%d;", &age);
{
for (currentmonth = 1;
currentmonth <= 12;
currentmonth++)

p("%d \n", currentmonth);

}
p("Input current month: ", currentmonth);
s("%d;", &currentmonth);
p("Input current date: ", currentdate);
s("%d", &currentdate);
p("Input birth month: ", birthmonth);
s("%d", &birthmonth);
p("Input birth date: ", birthdate);
s("%d", &birthdate);
if (currentmonth >= birthmonth)
{
daysalive = (age * 365) + (currentmonth - birthmonth) * 30 + (30 - birthdate) + currentdate;
p("The number of days you have lived is about %d", daysalive);
s("%d", daysalive);
}
else (currentmonth <= birthmonth);
{
daysalive = (age * 365) + (12 - birthmonth) * 30 + (currentmonth * 30) + (30 - birthdate) + currentdate;
p("The number of days you have lived is about %d", daysalive);
s("%d", daysalive);
}
}
modified it, got rid of ; on first if and it compiled FINE for me, what compiler are you using?
877.

Solve : To merge cell in MSFlexgrid ??

Answer»

Sir,
I have made an apllication in VB-6 in which I have USED MSFlexigrid. In this grid, there are TWO fixed rows
In 2nd Row :- First column is for Student Name while NEXT 4 columns are for Semester1, Semester2, Semester3, Semester4
In 1st Row :- I want to merge columns No 2 to 5 so that I may assign one single name to merged cell "SEMESTER" like as 1st row Semester
2nd row I II III IV
Is it possible, if yes, Please help me

Lohani

878.

Solve : How to launch a batch in a separate window, with a batch?

Answer» HELLO all,

As topic states, I am trying to launch a batch file with another batch. Here is my predicament, currently I am using the Call function. Call "Server1launch.bat" inside of my servermaintenance.bat. Well, what happens is the first batch sucessfully launches the second, but hangs until the other batch has "completed execution".

Normally this would be ok, except that the batch it launches starts a server and stays opened until the server is shut down, therefore hanging the initial "Servermaintenance.bat"

I have tried start "server1launch.bat", I even converted the batch into an exe in hopes of being able to "start" it. As a last attempt I created a shortcut and had it "start" the shortcut. In all 3 cases, it opens a new cmd window but only shows the window title, the directory path, then hangs. It does not attempt to execute the functions inside of the file referred to.

I really need some help on this one guys, its a wrench in my gears. Thanks in advance, I will happily supply more information as needed, if asked nicely. Try this:

start cmd /c YOURBATCHFILEHERE.BAT

instead of the call COMMAND. Use the start command to launch a new instance of %comspec% (usually this expands to C:\WINDOWS\system32\cmd.exe) with the /c switch; study start /? and cmd /? for full details

Code: [Select]start "" %comspec% /c batch2.batThanks very much guys, The two of you have solved my problem. I am much OBLIGED. I am sure ILL have more questions today..
Quote from: PPowerHouseK on October 11, 2009, 10:25:28 AM
Thanks very much guys, The two of you have solved my problem. I am much obliged. I am sure ill have more questions today..

Feel free to stick around. If you can help other MEMBERS out, it will be worth even more to you. You always learn when you teach.
879.

Solve : How to launch a program from a batch??

Answer»

Hello all,

Like the topic states I need to launch a program, serverdoc.EXE, and then close the batch. At this moment I am using the "start" FUNCTION and have tried the call function, they both have the same result.. It hangs until the exe crashes or is CLOSED, which should never happen.
Is there another command I COULD USE? I assume the start cmd ~ won't work with an exe. So what can I do?

Thanks in advance.
Well, this is embarrassing. I have noticed a large error in my syntax. The problem is solved. Please disregard the question.
Sorry for the inconvenience.

880.

Solve : Delete a folder if its over a certain size?

Answer»

Hello all,

I have returned with yet another dilemma for another unrelated project.

I need to delete a folder "F:\Backup\RegistryBackup" if it reaches a size over 1 Gig. I have attempted a round about way of detecting folder size but it will only output the folder size of the folder its currently IN. This as you can see causes a problem. For learning and understanding sake, I will post my entire CODE.

Code: [Select]@ECHO Off
TITLE Registry Backup Maintenance
COLOR F
ECHO *********************************************
ECHO * This Program was written by PPowerHouseK. *
ECHO *********************************************
cd F:\Backup\registrybackup
For /F "tokens=*" %%a IN ('"dir /s /-c | find "bytes" | find /v "free""') do @Set summaryout=%%a
For /f "tokens=1,2 delims=)" %%a in ("%summaryout%") do @set filesout=%%a&set sizeout=%%b
Set sizeout=%sizeout:bytes=%
Set sizeout=%sizeout: =%
ECHO ----------------------------------------------
Echo Size is :%sizeout%
ECHO ----------------------------------------------
IF %sizeout% gtr 100000000 ECHO Warning Backup Registry Size Larger than Allowed. Deleting...
IF %sizeout% gtr 100000000 DEL "F:\Backup\registrybackup"
ECHO ----------------------------------------------
IF %sizeout% lss 100000000 ECHO Registry Backup Size Within Allowed Limits.
ECHO ----------------------------------------------
ECHO Make sure you run the AutoReg.bat after this process.
IF EXIST "F:\Backup\registrybackup" ECHO Registry Still In Tact.
IF NOT EXIST "F:\Backup\registrybackup" ECHO Registry Successfully Deleted.
ECHO ----------------------------------------------
ECHO Proccess Completed.
ECHO ----------------------------------------------
pause

Any relevant suggestions would be excellent.here's a vbscript, that calculates folder size, without the hassle
Code: [Select]Set objFS=CreateObject("Scripting.FileSystemObject")
strFolder = "c:\windows"
Set objFolder = objFS.GetFolder(strFolder)
Go (objFolder)
Sub Go(objDIR)
If objDIR <> "\System Volume INFORMATION" Then
For Each eFolder in objDIR.SubFolders
FolderSize = eFolder.Size
WScript.Echo FolderSize, "bytes, path: " & eFolder.Path
' Uncomment the below portion to do something to those folders
' If FolderSize > <amount> Then
' do something....
'End If
Go eFolder
Next
End If
End Sub

save as myscript.vbs and on command line:
Code: [Select]c:\test> cscript /nologo test.vbs
Thanks for the speedy response. I have never USED vbscript, so this is quite confusing to me. How would I alter that code to delete the folder if its larger than one gigabyte?
Also, why does it need a command line? Can I not just double click it or refer to it from another batch? Thanks in advance.
Quote from: PPowerHouseK on October 15, 2009, 07:33:05 AM

Thanks for the speedy response. I have never used vbscript, so this is quite confusing to me. How would I alter that code to delete the folder if its larger than one gigabyte?
while i can give you the answer, i want you to find out for yourself how to. Use google.
Quote
Also, why does it need a command line? Can I not just double click it or refer to it from another batch? Thanks in advance.
you can also put that cscript command inside a batch file. Well, I do greatly appreciate your response. I have Very limited time, so i will be unable to rummage through google to find a way with VBscript to achieve that. Since I have tried that with the batch VERSION, I am certain I will just end up on another forum asking someone else, this time in a language I have no foundation to build upon.
Don't get me wrong, I would love to learn another language, but I think its best to stick with Batch, since I have a decent handle on it already.
So if anyone knows how to MODIFY my code , I would greatly appreciate it.Code: [Select]For /F "tokens=*" %%a IN ('"dir /s /-c | find "bytes" | find /v "free""') do @Set summaryout=%%a

Alright, apparently in this segment here you just insert the directory right behind the word dir. Learning is fun. Thanks for the wonderful help.
881.

Solve : How to modify this for loop:?

Answer»

Quote from: PPowerHouseK on October 16, 2009, 12:22:41 PM


I want to ONLY list the .MAP files as a map and skip the .map.zip
When the function lists the files in a TEXT, it lists alphabetically alternating the .map and .map.zip, beginning with the .map file. This may allow for counting every other one, or perhaps it would be more efficient to exclude the .zip file EXTENSION.



C:\>type list2.txt
house1.map
house1.map.zip
house2.map
house2.map.zip
house3.map
house3.map.zip
house4.map
house4.map.zip

C:\>type zip.bat
Code: [Select]@echo off

findstr /v "zip" list2.txt

C:\> zip.bat
house1.map
house2.map
house3.map
house4.map
C:\>


Well it now works perfectly. Thanks guys that did just the trick.
Special thanks to Bill and Salmon! You guys Rock!
I used Bill's code with Salmon's first adjustment.
I suppose this can be marked as SOLVED. PPowerHouseK wrote:

"When the function lists the files in a text, it lists alphabetically alternating the .map and .map.zip, beginning with the .map file. This may allow for counting every other one, or perhaps it would be more efficient to exclude the .zip file extension. This is where I am hung. "

See Input below*

C:\>type zip2.bat

Code: [Select]@echo off

setLocal EnableDelayedExpansion
echo. > ziplist.txt
echo. > finalziplist.txt

findstr /v "zip" list2.txt

findstr /v "zip" list2.txt > ziplist.txt

set /a c=0
for /f "delims=" %%a in (ziplist.txt) do (
set /a c+=1

set map!c!=%%a

echo map!c! = %%a

echo map!c! = %%a >> finalziplist.txt

)

REM echo map!c! = !map1!

OUTPUT:


C:\>zip2.bat
house1.map
house2.map
house3.map
house4.map
map1 = house1.map
map2 = house2.map
map3 = house3.map
map4 = house4.map
C:\>type finalziplist.txt

map1 = house1.map
map2 = house2.map
map3 = house3.map
map4 = house4.map

C:\>


*Input:

C:\>type list2.txt
house1.map
house1.map.zip
house2.map
house2.map.zip
house3.map
house3.map.zip
house4.map
house4.map.zip

C:\>
882.

Solve : How to echo the total files copied.?

Answer»

Hello All,

I would like to echo the total files copied by a function to a text file.
Basically a process will backup roughly 720 files but it varies, which is why i need to log it. The process uses xcopy, so at the end of it's task it displays 732 files copied.
I need to echo this number into a textfile for logging purposes. Any ideas? Will the copied files be the only files in the destination folder?if xcopy prints 732 files copied to the OUTPUT, then you can definitely redirect that output to a file. use the > operator (or >>)Quote from: Helpmeh on October 17, 2009, 09:33:04 AM

Will the copied files be the only files in the destination folder?
Yes, prior to copying to the directory, the batch deletes the destination directory to ensure they are the only files. ( I think I may know where your going with this, I like....)

Quote from: gh0std0g74 on October 17, 2009, 09:36:29 AM
if xcopy prints 732 files copied to the output, then you can definitely redirect that output to a file. use the > operator (or >>)
Sorry, it's kinda early here, can you elaborate for my simple mind?

Both: thanks for helpingQuote from: PPowerHouseK on October 17, 2009, 10:09:00 AM
Yes, prior to copying to the directory, the batch deletes the destination directory to ensure they are the only files. ( I think I may know where your going with this, I like....)
Sorry, it's kinda early here, can you elaborate for my simple mind?

Both: thanks for helping
Well, if what you are saying is true, the batch deletes any previous files, then do this to count the amount of files:

for /f "delims=" %%a in ('dir /B FOLDER') do set /a count+=1
echo Total files copied: %count%
echo Total files copied: %count% > totalfiles.txt

What Ghost is saying, is you can redirect the output of xcopy to the file, the same WAY I redirected the output of the second echo command to the file. Once again, thanks.
Here is what I attempted to use:
Code: [Select]for /f "delims=" %%a in ('dir /b C:\magic') do set /a count+=1
echo Total files copied: %count%
echo Total files copied: %count% > BatchLog.txtMagic contains the 732 files, yet the result of running this is:
Code: [Select]Total files copied: 1 I must have made a mistake somewhere...?Maybe add a \ after magic. Lol, that did it!!! I truly thank you all for helping me.
Am I asking too MANY questions? I surely don't want to flood the forums, but I do research my question as much as possible before asking.
Either way, thanks again. Quote from: PPowerHouseK on October 17, 2009, 10:55:53 AM
Lol, that did it!!! I truly thank you all for helping me.
Am I asking too many questions? I surely don't want to flood the forums, but I do research my question as much as possible before asking.
Either way, thanks again.
Trust me, asking questions here will never be bad. If people stopped asking questions this forum would die.
883.

Solve : copy and move files via batch file?

Answer»

Here is the situation: I have a group of files that are DROPPED daily into a network folder. Lets call them DataFile_091509_A.xls, DataFile_091509_B.xls, and DataFile_091509_C.xls. I need to copy these files into an archive folder within the folder where these files are dropped, then move them to a local folder, while renaming them to a STANDARD filename, ex DataFile_A.xls, DataFile_B.xls, DataFile_C.xls. I will overwrite the destination file names each day so that it inlcudes the most recent DATA.

Here is what I have so far:

REM Copy all datafiles into the Archive folder
copy "\\PATH\*A.xls" "\\PATH\Archive" /y
copy "\\PATH\*B.xls" "\\PATH\Archive" /y
copy "\\PATH\*C.xls" "\\PATH\Archive" /y
REM Move A
move /y "\PATH\*A.xls" "c:\DataFile_A.xls"
REM
REM Move B
move /y "\PATH\*B.xls" "c:\DataFile_B.xls"
REM
REM Move C
move /y "\PATH\*C.xls" "c:\DataFile_C.xls"
REM
REM

Now, this works just fine, but have I allowed enough room for error? Should I include SOMETHING in my MOVE that will only move the most recent version of the file in case something goes wrong the day before and files are not moved properly?

Any other alternatives?


PK
For more control, you may want to do this with a scripting language. Here is a script.


Code: [Select]# MoveData.txt

# Collect a list of files \\PATH\DataFile_*_*.xls.
var str list ; lf -n "DataFile_*_*.xls" "\\PATH" > $list

# Go thru files one by one.
while ($list <> "")
do

# Get the next file.
var str file ; lex "1" $list > $file

# Copy this file to \\PATH\Archive.
system -s "copy /Y " ("\""+$file+"\"") "\\PATH\Archive"

# Create the new file name by removing the date (between the two _).
var str newname ; stex -p "^/^l[" $file > $newname
# Replace _..._ with just _.
sal -r "^_&_^" "_" $newname > null

# Move file to C:\$newname.
system -s "move /Y" ("\""+$file+"\"") ("\"C:\\"+$newname+"\"")

done

Script is in biterscripting ( http://www.biterscripting.com ). Save the script as C:/Scripts/MoveData.txt. Start biterscripting and to run the script, enter the following command.

Code: [Select]script MoveData.txt

884.

Solve : pop ups?

Answer»

while i wait for anws. my computer when i get mail and on other sites parts of them have small red x or when i go to there http line in msg it WONT let me in. yellow bar ACROSS top comes and say POP up is blocked and i dont know how to get it to stop doing it. anybody know whyat to do let me know thanks GORDAN24 This should really be posted in the Internet Browsers (or Computer Viruses and Spyware) section.

Anyway, have you FOLLOWED the instructions here? The browser is probably hijacked.Thank you Dairyman for the ans to pop ups. My problem still exsists foe when i push enter on the word "here" in your msg it will do nothing. Thats why i said that i could not get into things LIKE that in msgs/reg sites after i get in or just about everything. gordan24 if you have any other ideas of how to get thru for ans let me know.

885.

Solve : booting up?

Answer»

my FRIEND down stairs bought computer. brought it home opened it up and put a stick of MEMORY in &AMP; sound card. then closed it. started it up and after screen windows 2000 stopped and on screen it said Inaccessible_Boot_Device than STOP 0x6(0)7B then at BOTTOM said run chkdsk/f hd CORRUPTION what does all this mean and can it be fixed.. timThis is not a programming question. The message means that the data on the hard drive is corrupted. Post in the Windows 2000 section.
If it's XP, boot to the Recovery Console and run chkdsk /r. Let's see what happens after that.Quote from: Allan on October 20, 2009, 02:02:12 PM

If it's XP, boot to the Recovery Console

Quote from: The OP
windows 2000 stopped
Missed that - but same answer applies.
886.

Solve : VB Software?

Answer» HI,
If any one is having VB software(Any version) PL. send me? No piracy ALLOWED. Read the rules. You can DOWNLOAD Visual Basic 8 Express for free though.

http://www.microsoft.com/express/vb/Default.aspx
887.

Solve : Attribute to txt and back doesn't work in batch, please help me?

Answer»

I'm trying to make a batch file which makes an attribute from a folder by using the %cd% command. After the batch has made the attribute it writes it to a text file. Then after exiting the batch I want to make another batch open the text file and then make a new attribute from it.
This is what I have (well, only the essential part of the code for this question)
Code: [Select]set Path=%cd%
echo %path% >> Path.txt
So after this I want something like Code: [Select]set Path=Path.txt but that doesn't do what I want because I want the original path as output, not the file name.
I hope I made clear what my problem is.
I've been looking for hours to find a solution, but I really haven't been able to find it anywhere. So can anybody please please help me.%cd% is not a "command" it is a variable. It holds the path of the current directory. Regarding your script, it would be dangerous and foolish to set the PATH variable to contain just one folder, because then many programs and commands would not work. Why do you want to do this? I am suspicious of those scripts where the author only presents the "essential part". What are they hiding? Sounds like a would be script kiddie or prankster.

Well, what my program is MEANT to do is make a backup of a file and then copy another file to that place to to it's place, and there's also an uninstall option which deletes the other file and then place the original file back. I'm using this to be able to switch between those two files. But to make it more versatile I wanted to be able to USE the batch not only from the folder it's in, but from any folder it's in. For this I made this piece of code (which again is not my complete program, but that would just be a huge field of text with a lot of echo's):
Code: [Select]set Path=%cd%
if not exist "%Path%\main-bg.bmp" GOTO Manual
Manual:
SET Path=
SET /P Path=Type the path where main-bg.bmp is and then press Enter
if exist "%Path%\main-bg.bmp" echo %path% >> %cd%Path.txt This checks if the original file is there, and if it is it makes a txt file with the right folder (in the same folder as the batch file, so this doesn't have to be the same folder as main-bg.bmp), I wanted to use this to be able to run the uninstall without having to set the path again. So the uninstall will have to read the .txt and use that to determine at what path it should be.

My complete program is way to big to post because of a lot of echo's to make it easier to use. I hope this post made it clearer what i am trying to do, but I assure you it's not some sort of virus or such nasty stuff.What you do not seem to realise is that (put simply) there is a system variable used by Windows called %PATH% which stores a list of folders where executable programs and scripts may be, so that when you want to run say Regedit you don't have to type "C:\Windows\Regedit.exe", you can just type the name. If you alter the contents of %path% then many programs will not work therefore. In general to avoid odd behaviour and confusion people avoid creating variables which have the same name as system variables. It would be better to choose another name for example %mypath% or whatever.

There are at least two ways I know of to get a line of text from a file into a variable.

Previously save to file. Don't forget to use quotes around a path+filename which has spaces.

Code: [Select]echo %mypath%>"c:\path with spaces\mypath.txt"
(1) load from file using SET /P

SET /P normally gets ENTER-terminated input from STDIN (the keyboard); by using the < redirection SYMBOL it can be made to get a (one only, the first) CR/LF terminated line from a file.

Note: File should have only 1 line; if it has more, variable will be set to the FIRST line.
Code: [Select]set /p mypath=<"c:\path with spaces\mypath.txt"


(2) load from file using FOR

Precede set with an @ symbol to avoid echoing to the screen

Note: File should have only 1 line; if it has more, variable will be set to the LAST line.
Code: [Select]FOR /F "usebackq delims==" %%A IN ("c:\path with spaces\mypath.txt") DO @set mypath=%%A


Using EITHER of the above 2 methods, the quotes around the path\filename are optional if there are no spaces, but necessary if there are spaces.







Holy sh... this stuff works. Thank you so very very much.
OH man, if you'd only know how happy I am now
Well, case closed I'd say. Thanks again Quote

this stuff works.

Only tried and tested solutions carry the Salmon Trout label, unlike certain other brands You guys are overcomplicating things.

Set /p var=Quote from: Helpmeh on October 24, 2009, 01:54:54 PM
You guys are overcomplicating things.

Set /p var=<Filename.txt

That was the first of my 2 offered solutions. Didn't you notice? The solution using FOR is capable of further development e.g. if extraction of tokens is desired.
888.

Solve : CMD messenger?

Answer»

hi, i've tried to make two Cmd messengers and both of them don't work.

for one of them i tried:
Code: [Select]@ECHO off
Echo Messanger
:A
set /p n=USER
set /p m=Message
net send %n% %m%
Goto Aand i end up getting this

Code: [Select]The syntax of this comand is:
NET
[ Accounts | COMPUTER | CONFIG | CONTINUE | FILE | GROUP | HELP|
HELPMSG | LOCALGROUP | PAUSE | PRINT | SESSION | sHARE | START |
STATISTICS | STOP | TIME | USE | USER | VIEW]

The other way i tried to make it is
Code: [Select]:A
set /p n=USER
set /p m=Message
msg %n% %m%
Goto A
where i end up getting
Code: [Select]'msg' is not recognized as an internal or external command, Operable program or batch file
does anyone have any ideas whats wrong?Msg is only in Windows XP Pro and vista (I don't have it). Try typing
net send /?
At the command PROMPT to see the correct syntax. The computers have to be networked or the "messenger" won't work either. Quote from: Helpmeh on October 17, 2009, 04:53:07 PM

Msg is only in Windows XP Pro and vista (I don't have it). Try typing
net send /?
At the command prompt to see the correct syntax. The computers have to be networked or the "messenger" won't work either.


NET
[ Accounts | COMPUTER | CONFIG | CONTINUE | FILE | GROUP | HELP|
HELPMSG | LOCALGROUP | PAUSE | PRINT | SESSION | sHARE | START |
STATISTICS | STOP | TIME | USE | USER | VIEW]

this is what it gives me of net send/?
there's a space between send and /?.

Also I believe the messenger service is disabled in XP SP3 and Vista SP1 and up.Quote from: BC_Programmer on October 17, 2009, 10:34:15 PM
there's a space between send and /?.

Also I believe the messenger service is disabled in XP SP3 and Vista SP1 and up.

yes i have DONE it with and without spaces i get the same response everytimeoh. Windows Vista doesn't have net send.... as notable in the list is gives you when you try Quote from: BC_Programmer on October 18, 2009, 09:56:10 AM
oh. Windows Vista doesn't have net send.... as notable in the list is gives you when you try

Indeed

Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\>net
The syntax of this command is:


NET [ ACCOUNTS | COMPUTER | CONFIG | CONTINUE | FILE | GROUP | HELP |
HELPMSG | LOCALGROUP | NAME | PAUSE | PRINT | SEND | SESSION |
SHARE | START | STATISTICS | STOP | TIME | USE | USER | VIEW ]


there is no send command for net on vista i found out ,

but the thing is when i type in MSG which i HEARD is still a command it dosnt work
MSG only works if the other user has messaging enabled. On many networks it is disabled. Type MSG /? to see the help.
Quote from: Salmon Trout on October 25, 2009, 02:42:21 PM
MSG only works if the other user has messaging enabled. On many networks it is disabled. Type MSG /? to see the help.

anything like
MSG
or
MSG /?

says that MSG is not a command though. and i know its not BLOCKED on this network because its my home network and i made it myself and i'm the adminWhat is your OS?
Quote from: Salmon Trout on October 25, 2009, 04:33:32 PM
What is your OS?

its windows Vista home primiumVista home does not have MSGQuote from: Salmon Trout on October 26, 2009, 03:46:26 AM
Vista home does not have MSG

so it doesn't have Net send or MSG .....
889.

Solve : New Line in Visual Basic?

Answer»

I'm writing program in Visual Basic 8.0. I don't know how to put a text in new line.

for example I write the following code

TextBox.Text="abc" & "defg" & "ijkl"

The output will be

abcdefgijkl

But I need the following output

abc
defg
ijkl


Please tell me or write the code to display the above output. Thanx in advance...


MultiLine = True
vbcrlf"vbcrlf"

Is this is code ? Where it has to applied ? Write with an example, Really I don't know....You said you wrote a WHOLE program in VB8 and you want to convert it to VB6, and you don't understand how to do this?
This only THING i really don't know...... I never tried before..... Please tell me now i have the need of it.http://www.google.co.uk/search?hl=en&safe=off&num=100&q=vbcrlf+visual+basic+8&btnG=Search&meta=&aq=f&oq=1. At the design stage, SET the multiline property of the textbox to true.
2. TextBox.Text="abc" & vbcrlf & "defg" & vbcrlf & "ijkl"
New Line character:

Code: [Select]ControlChars.NewLine()
If you add that in like this:
Code: [Select]Textbox1.Text = "First Line" & ControlChars.NewLine() & "Second Line"
But like Salmon said, the textbox has to be Multiline for this to work.

Hope this HELPS
,Nick(macdad-)ControlChars.NewLine() and vbcrlf are equivalent.
Yes, and considering this same poster was querying converting a "VB8" (what most people would call VB 2005, I think) to VB6, it makes more sense to use the more compatible vbcrlf then the ridiculously VERBOSE static method.Thanks for your help, all your answers helped me and worked well, Thanks again.....

890.

Solve : vhdl programming?

Answer»

how can i write a 100 bit adder & SUBTRACTOR with 1 bit adder component?
should i repeat it 100 tims ? It is a solution, HOWEVER, there should be a better way

I can't come up with any good ideas..Is this homework assignment?
Well, I would think that you have studied the very simple logic of an adder. If not STOP wasting your time here and hit the books. I well help you to see how a 1 bit adder (ONE output - high or low) can be chained to get what you want. But please do yourself a favor and go back to simple binary addition to see what adders actually do. Here is the adder example:


As you can see it was just as you thought it was. I will let you think about what a 1 bit subtractor is. Hint: Got to be similar RIGHT???

Good Luck

891.

Solve : How to convert VB8.0 to VB6.0?

Answer»

I'm working with Visual Basic 8.0 , now I need to convert the project to Visual Basic 6.0.
Is there any software or solution that convert 8.0 files to 6.0 ?manual rewrite is probably the only way, given the huge differences.They are essentially completely different languages.

There is no easy VB6 to VB8 tool either. (unless you count the tool that makes a template and throws a bunch of TODO comments everywhere)Visual Basic 8.0 would convert the files or projects that are written in VB6.0 with telling some instructions to modify the code such as depreciation of datatype..... etc... But again writing 8.0 to 6.0 is a huge task. But i need to write. If there is any possibility please tell me. I'l wait ............

But I'l write the code into 6.0 until I get the solution........ ThannxVB 8 is object oriented. VB 6 is not. If you are any kind of programmer, that should tell you all you need to know about the nature of the task (you think) you need to undertake.
Yes i know about it. But i need to convert otherwise i have to write manual code in visual basic 6.0. It takes a lot of time and stuff so that i asked you people, if there is any tool or suggestions to convert 8.0 files to 6.0..........


If any any any...... tell me. I'm starting writing the code in 6.0Quote from: Vikram Varaprasad on October 24, 2009, 12:52:48 AM

otherwise i have to write manual code

Oh I think I grasp the nature of your problem!

[rant]
This is what programmers do. Isn't it? (actually it is only part of what they do) Presuming that you wrote the program so far, and did not merely copy and paste a lot of code snippets you found on the web, glueing it together somehow, then you will have had an overview of what the program is supposed to do, a SPECIFICATION if you like, following which you proceeded to think carefully what the program flow would be like, what algorithms, etc you needed to IMPLEMENT, and then finally you fired up your IDE and typed in the code, testing as you went ALONG. It is only this final step (in many ways the most trivial) that you need to repeat.
[/rant]
Yes..... exactlyQuote from: Vikram Varaprasad on October 24, 2009, 01:43:03 AM
Yes..... exactly

Good luck!
Quote from: The OP
It takes a lot of time and stuff


OMG SALMON, I have never laughed so hard...

Of course you could have told him that the vb8 to vb6 convertor is readily available for anyone willing to to make SIMPLE minor changes to his original code. He will only need his logic scheme for reference. Perhaps a new manual wouldn't be a bad idea.

Still laughing...
892.

Solve : Help with UNIX scripting??

Answer»

I'm making two basic DATABASES for a practice scenario. ONE has a person's first and last name and some other made up 'personal' information. (Like address, birthdate, ect) The other database will be a list of products.

However, I wish to add an identification number to both databases, and then make a third database to merge the two, or emulate a person BUYING an item and matching them with ID's. I wish for the ID's to start at 10000 so I can make a simple grep script for the third database. (Otherwise it may return integer values from an address)

Both of these databases are quite small which is why I only want the ID's to be 10000ish. Anyone have any insight to this? If you want me to post a code sample LET me know. I'm mainly confused if I can do this with an if statement or if I'd need a while/until loop to figure this one.

893.

Solve : Easiest Language to Learn??

Answer»

Quote from: BatchFileCommand on October 22, 2009, 07:22:28 PM

Well, Keyloggers are fairly easy to make with autoit.

Lets not give anyone any ideas Can some one please answer my question?Try reading the POSTS. The short-medium ones are probably the most useful. The long ones are mainly RANTING at other members. Quote from: Redcaa on October 29, 2009, 12:55:20 PM
Can some one please answer my question?
there's no one true solution to your PROBLEM. the meaning of "easiest" are not the same for everyone. This also depends on what you want to do. So just get started on any one of them already. How much time are you still going to waste around here looking for an open ended questions that has no answer.? OK. One last shot.
It is not the language. It is the style.
You can do teach in COBOL.
You can be elegant in C.

Years ago I paid a lot of money to learn PL/1. Some feel that it was the turning point of reason against chaos.

Here is a book about the idea of structured programming. Some say that it is bunk. Others BELIEVE it will save the world.

http://www.amazon.com/PL-Structured-Programming-Joan-Hughes/dp/0471837466

This thread has gone too long. The OP should now have enough.I wasn't reffering to my first post. If you had read my last post I asked that

Quote from: Redcaa on October 18, 2009, 09:10:06 AM
Seems interesting. Thanks Salmon. Also I had a GO at Just BASICS and it seems easy.

@Kpac You know you said " you can also use it in Web applications" what do you mean by that?

E: Ok I just downloaded the Self Extricating zip so I can keep it on my USB but I have no idea which file to open D:
894.

Solve : programing?

Answer»

Hi, i am new to PROGRAMING, What would be the best way to teach myslef. Thanks Chef Jerry.There are 1 of 3 main ways people learn.
1) watching/looking/reading (visual)
2) hearing (audio)
3) doing/trial and error (kinetic)

How you learn is beyone the scope of everyone here so to ask "how can I best teach myself" is a useless question. Figure out what you want to do, what you want to do with what you've done, and learn to do it. If you're (1) then watch someone do it or read a book, if you're (2) then someone to tell you how, if you're (3) then just try and figure it out.

Quote

What would be the best way to teach myslef

If you can't figure yourself out, I'd wait to learn programming.Hi Jerry,

I agree with Joleen. my self learn method is to buy / borrow programming books and read thoroughly. Visit websites. install compilers and start programming.Thank you for, "Three Ways People Learn" list. You are right; first, I should discover and decide the best way for me to learn Raptor Programming.

"Three Ways People Learn"

1. Watching, Looking, Reading and being visual.
2. Hearing and listening (Audio)
3. Doing, trial and error (Kinetic).

You have helped me, start at the BEGINNING of learning Rapor Programming and not quit until I achieve my goal.

Sincerely,

CLF

try going to a website, for example www.python.org has a free download of python, and a tutorial on it too that is also on the site. Quote from: Joleen on July 05, 2004, 07:00:20 AM
There are 1 of 3 main ways people learn.
1) watching/looking/reading (visual)
2) hearing (audio)
3) doing/trial and error (kinetic)

How you learn is beyone the scope of everyone here so to ask "how can I best teach myself" is a useless question. Figure out what you want to do, what you want to do with what you've done, and learn to do it. If you're (1) then watch someone do it or read a book, if you're (2) then someone to tell you how, if you're (3) then just try and figure it out.
If you can't figure yourself out, I'd wait to learn programming.

trial and error is what always works for me best, it may not be the fastest way to learn something but i think i always get the thing down better when i learn it that wayThe best way is #3, Trial and Error
Start with Visual Basic, it has thousands of help Topics.

To have someone show you how to do it does not help. You will forget the next minute how to do it.
If you write all that good advice down, than you will be forever looking at those notes. It has to come right out of your head.
You will find that after doing things a thousand time the wrong way, and screw up the program or what ever a thousand TIMES, you will finally get the hang of it.

Believe me, I started programming in 1965, and on major complex systems.

Trial and error my friend!



Quote
show you how to do it does not help

If you mean by showing the logic then yes, otherwise that's not true. At last in my case. If someone is showed how to perform logic OPERATIONS then they won't know how to think for themselves. But if someone has no clue how the function works then it's best to have an experienced programmer to explain the function in a more simpler terms. Most of the time descriptions are equipped with unnecessary information for beginners and it just complicates things.this thread is four years old...u have to read programming books,understand well the containing informations nd then u have to practise,look for ur FAULTS nd that way u can improve ur level.don't forget to get help always when u give up from trying lonely
895.

Solve : How to store a user input as a variable??

Answer»

Hello all,

I have RETURNED with yet ANOTHER batch problem. I need to ask the user to "ENTER their name" which I can then store as a %user% variable to later implement in a command.

For example after the user inputs the name, the program can then do:
Code: [Select]cd C:\programfiles\uniquenames\%user%\home
So, I have no idea where to begin. Thanks in advance.Code: [Select]set /p user=Name:

cd C:\programfiles\uniquenames\%user%\home
I think you may have to use "%user%" (with QUOTES) if there are spaces, not sure.That was exactly what I was looking for. You have SAVED me so much time!

Thanks again for all the help!

896.

Solve : deleting writing protection from a memory stick?

Answer»

how can i delete that protection from a memory stick.if want to format it or delete some files a message APPEARS DECLARING that the memory stick is protected from writing.thanks If there is no switch for write protection on your memory stick then try to format it in Win XP. If you get an error saying unable to format then chances are that you have a virus on your memory stick that is preventing access to it except for read. There are antivirus softwares that remove this. However if you have access to a linux OS, simply insert this memory stick and once mounted you can manually locate and remove the virus. This will solve your issue. Even XP might ALLOW this by using the command prompt and commands like attrib -h -s to remove the system file attribs from the virus file upon which you can simply right click and delete that virus file.

*NOTE* VISTA will let u do the same thing as XP, just follow the formati am thankful.ahha, it worked im guessingyes blake it does! nd thanks for helpNo problem man, no problem at all. Was it just a LOCK switch, or was it a virus?it was a virus bro!uh oh, Well at least you got it off dude.
yeah man!

897.

Solve : choice=0 ???

Answer»

So this is from a tutorial in python:
Code: [Select]#calculator program

#this variable tells the loop whether it should loop or not.
# 1 means loop. ANYTHING else means don't loop.

loop = 1

#this variable HOLDS the user's choice in the menu:

choice = 0

while loop == 1:
#PRINT what options you have
print "Welcome to calculator.py"

print "your options are:"
print " "
print "1) Addition"
print "2) Subtraction"

print "3) Multiplication"

print "4) Division"
print "5) Quit calculator.py"
print " "

choice = input("Choose your option: ")
if choice == 1:
add1 = input("ADD this: ")
add2 = input("to this: ")
print add1, "+", add2, "=", add1 + add2
elif choice == 2:
sub2 = input("Subtract this: ")
sub1 = input("from this: ")
print sub1, "-", sub2, "=", sub1 - sub2
elif choice == 3:
mul1 = input("Multiply this: ")
mul2 = input("with this: ")
print mul1, "*", mul2, "=", mul1 * mul2
elif choice == 4:
div1 = input("Divide this: ")
div2 = input("by this: ")
print div1, "/", div2, "=", div1 / div2
elif choice == 5:
loop = 0

print "Thankyou for using calculator.py!"

What does "choice=0" do, I know it says to hold the users choice in the menu, but when i get rid of it, the calculator still works the same. So what does it mean by holding the users choice?no, choice=0 is not needed, since in the while loop , it will have a value somehowthe writer of the tutorial is probably used to languages that don't initialize variables on first use. Basically they are initializing the variable, but python already does that so it's redundant.Okay.

898.

Solve : intendent tool??

Answer»

Is there any tool which can open files containing C++/Pawn code and intendent it correctly?

Very often I have to do it the MANUAL way, which takes way too much time..

Example:

BAD Code:

Code: [Select]OnPlayerCommandText(playerid, cmdtext[]){
if(strcmp(cmd, "/test", true) == 0)
{
if(IsPlayerConnected(playerid))
{
// Blah
if (PlayerInfo[playerid][pAdmin] >= 7)
{
SendClientMessage(playerid, COLOR_YELLOW, "Your an High-level administrator.");
}
else
{
SendClientMessage(playerid, COLOR_YELLOW, "Your not an administrator.");
}
}
return 1;
}
return 0;
}
Good Code:

Code: [Select]OnPlayerCommandText(playerid, cmdtext[]){
if(strcmp(cmd, "/test", true) == 0)
{
if(IsPlayerConnected(playerid))
{
//Blah
if (PlayerInfo[playerid][pAdmin] >= 7)
{
SendClientMessage(playerid, COLOR_YELLOW, "Your an High-level administrator.");
}
else
{
SendClientMessage(playerid, COLOR_YELLOW, "Your not an administrator.");
}
}
return 1;
}
return 0;
}I believe the term is "indent" and it's also referred to as "FORMATTING" the code. there are tools of this sort for nearly every programming language. Explains why I couldn't find anything...Quote from: Ryder17z on November 20, 2009, 04:57:30 AM

Explains why I couldn't find anything...



yeah I assumed that SINCE you had the wrong term your google results might be a tad... skewed...
899.

Solve : Drivers programming?

Answer»

Which language generally all driver software is being created ?
can't we create our own drivers ?
How the drivers interact with the hardware ?
What's the general difference b/w general programming and driver programming ?Windows Drivers are written with C/C++ with the Driver Development Kit.

Main difference is a error in the driver will cause a bluescreen rather then a friendly little fault box.as it was said by BC_prog...?the windows drivers are written with c/c++ language ,the language created by Dennis Ritchie on the seventies in BELL:USASomething is missing in your answers......
The little information what I knew is the answers given by u.....

The answers for the remaining questions are missed..........
I need explanation.... QUOTE from: Vikram Varaprasad on November 02, 2009, 12:50:08 AM

Which language generally all driver software is being created ?
can't we create our own drivers ?
What's the general difference b/w general programming and driver programming ?
3/4 solved. I'm not satisfied with your answers.......
I need expert answer.

Can't we create our own drivers ?
How the drivers interact with the hardware ?
Quote from: Vikram Varaprasad on November 04, 2009, 10:30:23 PM
I'm not satisfied with your answers.......
I need expert answer.
THESE ARE THE EXPERTS!

If you aren't satisfied, nothing is preventing you from closing the window and never coming back. You don't have any priviliges to say it. I didn't satisfied with the answers. I need an expert answer mean "I need more explanation with examples". If they know they certainly PROVIDE it, I know. There are lot of experts in the forum (100%) they'l give the better answer if they saw my post. You child don't be silly in giving such nasty posts........Quote
Can't we create our own drivers ?

well you can but it's generally agreed that you would need to know what your doing. Any error caused by a driver will cause a kernel mode BSOD (the user mode fault dialog is the same thing as a BSOD, but since it was user mode code it was recoverable)

(windows for example would use the DDK and any stdcall capable language)

Quote
How the drivers interact with the hardware ?

This depends on the platform. many platforms implement a "hardware abstraction layer" which virtualizes CALLS to hardware components. Hardware is accessed just as it always has been- through mapped memory addresses, or mapped memory. One example being to store a memory BLOCK in mapped device memory and then call a hardware interrupt; the ahrdware device interprets the memory contents and performs a task, or performs a task with that memory (such as send it out to the network).


The main difficulty with your QUESTION is the assumption that drivers are the same under any architecture and operating System. This is not so. With Linux, there are a number of different technologies that can be leveraged to write a driver; DOS is another architecture altogether; your question has a different answer for each one.Quote
The main difficulty with your question is the assumption that drivers are the same under any architecture and operating System.

Hey ! I know about this.... but I have a little curiosity especially for windows os how they are interacted. Thanks for your help.Quote
I'm not satisfied with your answers.......

You have no manners.
Sorry, it will never happens.....
900.

Solve : How to program Star dot matrix printer??

Answer»

I have a PC running windows xp and have been trying to format (change line and character spacing) on files printed on a star micronics dot matrix printer. The CODES aren't CHANGING the spacing, instead they are printed. The codes I'm using are from star's web page. Please show how you are using the codes
Also, he should provide the model number and state if it has an an emulation for the old Epson printers.
Just looked in and old archive and fun this:

Code: [Select]CHRS Ver 1.0 by J B Palmer
CHRS 07 0A = BELL, LINE
CHRS 0C = TOP OF FORM
CHRS 0F = CONDENSED
CHRS 1B 30 = 8 LINES/INCH
CHRS 1B 43 21 = 33 LINE FORM
CHRS 1B 45 = EMPHASIZED
CHRS 1B4408100 = TABS 8 & 16

You don't just print them verbatim, for example "CHRS 07 0A". Those are hexadecimal representations of the bytes you send to the printer. via the serial or parallel port. I used to use QBasic for this. Using 1B 30 for an example:

LPRINT CHR$(27);CHR$(48);"This is 8 lines per inch"

You COULD insert them into eg WordStar and WordPerfect documents using various MEANS.


The printer is a star-micronics SP300. When I pull up the printer properties there is a place to enter Star's control codes and text for the receipt . I got the codes from Star's website. The code to change the line spacing to 7/72" is "1" . When I enter these codes they print and don't change the line spacing. When I asked Star's support for help all they said was to use brackets.Here is the Programmer's manual

http://www.ben.cz/_download/manual/sp300-programming-manual-en.pdf



Here is a link to the directory that has CHRS.COM dos program. It is virus free.
http://geek9pm.com/dos/
CHRS.COM sends a string of binary characters to the system printer. It expects hexadecimal to be used on the command tail.
So "1" should be 1B 31
Like this:
CHRS 1B 31

I hope this is helpful. We used this years ago when using Epsom printers to print forms that would not fit on the paper with the default settings.