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.

1501.

Solve : VBA Excel 2010 export to add to a central CSV or xlsm file?

Answer»

Good Morning,

I need a bit of help exporting from Excel 2010 to a csv file.

Details:

My company uses an Excel workbook to quote our customer's components.

For every part we quote there is a copy of this workbook saved that GOES with each part.

My goal is to have each user run a macro that exports fields A3:BA3 from worksheet "DatabaseReport" upon completion of the quote to a centrally located csv file or another centralize workbook at location "c:\Quotes\Database\CommonQuoteTable.csv (xlsm) The macro must WRITE to an OPEN row so that any existing information that was populated by the same macro in a different copy of the quote workbook is not overwritten.

I will be using this "commonQuoteTable" in Access 2010 so if I can accomplish this by WRITING to an access table rather than a csv or spreadsheet would be ideal. However I spent a lot of time trying to find a way to do that without success.

I'm sure you can see the BENEFITS of having all of my quoted information in one location. I will be able to monitor success rates, query by customer, buyer, part size etc.

Thanks for any guidance you can give.

Chad
Pretty please with sugar on top??Never mind I figured it out.

On to a new problem. Looking up the last record in a csv file or access table to generate the next integer to use as a quote number.

Thanks,

Chad

1502.

Solve : [Lua] More help needed?

Answer»

So it's giving me
Code: [Select]C:\PROGRAM Files (x86)\Lua\5.1\lua.exe: T:\space\Game\bin\f.lua:19: attempt to p
erform arithmetic on a nil value
stack traceback:
T:\space\Game\bin\f.lua:19: in function 'theta'
T:\space\Game\bin\f.lua:38: in main chunk
[C]: ?
when it has clearly become a number multiple times. Any help would be grand.



f.lua 1 300 -300 300 0 0 0 130
Code: [Select]-- Testing Ground for Space Game
-- 1 = Find F_x, F_y, and F_z
-- 2 = Find Theta.x, Theta.y, and MAGNITUDE
-- 3 = Find magnitude of Gravity




grav = function(g,d)
--gravitation <Gravitaion> <distance>
if (g/d) == (1/0) then
RETURN g
ELSE
return(g/d)
end
end


theta = function(x1, y1, z1, x2, y2, z2)
local x = tonumber(x2) - tonumber(x1)
local y = tonumber(y2) - tonumber(y1)
local z = tonumber(z2) - tonumber(z1)
-- 1
if arg[1] == "1" then print(math.floor(grav(tonumber(arg[8]),x)+0.5) .."," ..math.floor(grav(tonumber(arg[8]),y)+0.5) .."," ..math.floor(grav(tonumber(arg[8]),z)+0.5) ) end


-- 2
if arg[1] == "2" then print("theta.x=" ..math.floor( ( math.tan( y / z ) )*1000+0.5 ) / 1000 ) end
if arg[1] == "2" then print("theta.y=" ..math.floor( ( math.tan( math.sqrt( y * y + z * z ) / x ) ) * 1000 + 0.5 ) / 1000 ) end
if arg[1] == "2" then print("magnitude=" ..math.floor( (math.sqrt( x * x + y * y + z * z ) ) * 1000 + 0.5 ) / 1000 ) end
-- 3
if arg[1] == "3" then print(grav(math.floor( (math.sqrt( x * x + y * y + z * z ) ) * 1000 + 0.5 ) / 1000, arg[8]) ) end
if arg[1] == "3" then print("theta.x=" ..math.floor( ( math.tan( y / z ) )*1000+0.5 ) / 1000 ) end
if arg[1] == "3" then print("theta.y=" ..math.floor( ( math.tan( math.sqrt( y * y + z * z ) / x ) ) * 1000 + 0.5 ) / 1000 ) end

end

arg = {...}
theta(tonumber(arg[2]),tonumber(arg[3]),tonumber(arg[4]),tonumber(arg[5]),tonumber(arg[6]),tonumber(arg[7]))
you to a new table and then access elements of that table. All elements of that table will be nil.Fixed it, It had to do with inputting things that couldn't be changed to numbers.

1503.

Solve : Quick Course C++?

Answer»

I am doing a quick course on C++ and the book told me to build a program.

However, each time I do so it generates this error:

Quote

d:\c++ weekend crash course\work\conversion.cpp(13) : error C2676: binary '>' : 'class istream_withassign' does not define this operator or a conversion to a type acceptable to the predefined operator
Error executing cl.exe.


The book is from 2000 and is called C++ Weekend Crash Course

I am using Microsoft Visual 6.0 C++ Standard Edition

What could that error possibly mean?

I have looked on the Internet, but what I found made no sense to me.

A friend of mine is doing the exact same with the same VERSION of Visal C++ and runs into the same error...

Here is the program I am told to recreate..

Code: [Select]//
// Program to convert temperature from Celsius degree
// units into Fahrenheit degree units:
// Fahrenheit = Celsius * (212 - 32)/100 + 32
//
#include <stdio.h>
#include <iostream.h>
int main(int nNumberofArgs, char* pszArgs[])
{
// enter the temperature in Celsius
int nCelsius;
cout << “Enter the temperature in Celsius:”;
cin > nCelsius;
// calculate conversion FACTOR for Celsius
// to Fahrenheit
int nFactor;
nFactor = 212 - 32;
// use conversion factor to convert Celsius
// into Fahrenheit values
int nFahrenheit;
nFahrenheit = nFactor * nCelsius/100 + 32;
// output the results
cout << “Fahrenheit value is:”;
cout << nFahrenheit;
return 0;
}


Copied from a .PDF document into a forum.. The layout's a BIT.... messy now.Code: [Select] cin > nCelsius;

Had to be

Code: [Select] cin >> nCelsius;

I wonder if they ever bother to DOUBLE check important things on SPELLING errors.. No wonder wars are started.As you've already found out.. a missing "" or ; can completely blow apart your app. Syntax is everything and spelling is huge. Happy learning.I am aware of that - however, this was not my fault:

cin > instead of cin >>

(The writer's Texan, and we all know what comes from Texas..)Quote
this was not my fault

A wise carpenter never blames his tools.Quote
A wise carpenter never blames his tools.




nice quote there Joleen Quote
nice quote

Indeed it is. As you'll probably know, Raptor and I frequently poke fun at each other both here and on MSN. No insult is intended except the friendly one found in any friendship.group hug
1504.

Solve : MSDN (Juli 2004)?

Answer»

I managed to OBTAIN an (outdated) version of MSDN.

I installed it because it APPEARS that Microsoft Visual 6.0 C++ allows you to make use of it, HOWEVER, how do I get MSV C++ to detect it once it's installed?

Uh if you installed it then what is it you're trying to detect?I have MSDN. I have Visual BASIC C++ 6.0

I cannot get Visual Basic to access the MSDN database. Most likely because Visual Basic was installed before MSDN.

What do I do to correct the problem?

How do I view the MSDN database?Issue still stands uncorrected.

1505.

Solve : .bat Image Renaming For WD TV Live?

Answer»

Hello all,

Apologies if this has been answered, the search gives something similar but not exactly what I'm after.

I use XBMC and a Western Digital TV Live as media centers. XBMC uses folder.jpg for movie BOX art. However, the WD uses both folder.jpg and moviename.jpg.

My folder structure is as follows:

Films\movie1\movie1.mkv(or avi ETC...)
Films\movie1\folder.jpg
Films\movie2\movie2.mkv (etc...)
Films\movie2\folder.jpg

What I'm after is a .bat file that will scan the entire films DIRECTORY, copy the folder.jpg and rename the new jpg USING the name of the folder that folder.jpg is in. The original folder.jpg should remain.

Essentially from:

Films\movie1\folder.jpg

To:

Films\movie1\folder.jpg
and
Films\movie1\movie1.jpg

This should happen to each folder in Films.

I'm sure this must be POSSIBLE but to be honest my knowledge of .bat files is very limited.

Thank You for any help you can provide.


Jonathan

1506.

Solve : C++?

Answer»

Have just started to learn C++ from the Ubuntu COMMAND line and i am enjoying it so far.
The only thing i don't like is the lack of simple programs for beginners like myself to look at and hopefully learn from.
Is there anyone here who would like to SHARE a link for beginner C++ programs.
Thanks all.Lots of examples here

http://www.rosettacode.org/wiki/Category:C%2B%2B
Big thanks for the link SALMON Trout.

1507.

Solve : ArrayList in PHP Question - Find line in file and populate with list data?

Answer»

Making a Turn Based RPG game to strengthen skills in PHP and looking for advice on handling population of stats per usable items.

To me it seems as though a list would be usefull such as an ArrayList to where say a piece of gear is looted from the seeded random generator, that points at say element 88 on the loot table ( also ArrayList for now until I implement mySQL Database) and 0-99 srand spits out 88 in which at the ArrayList the data contained within the location of ArrayList[88] is item 0179. Now Item # 0179 has a list of information associated with it such as the following data components, where the last 4 stats are for better items that have benefit abilities that the integer for each one either disables any benefit at all with a 0 or say 1 = +10 strength, and 2 = +20 health on top of the base level stats that each player is given based on their player class etc.

Item# - Description - Swings per turn - minimum damage - maximum damage - stat0 - stat1 - stat2 - stat3

0179 - Broad Axe - 1 - 10 - 20 - 0 - 0 - 2 - 1

So the ArrayList is populated with ("0179, Broad Axe, 1, 10, 20, 0, 0, 2, 1")

But the problem is that I need to call 0179 and then confirm a match to 0179 of the first element of the list, and then populate the mixture of string and integer data into variables which then are used to populate the player stat build, and I am curious as to how I can populate this info into the ArrayList from a file, when I would need to have either a file for each and every item which would be foolish, or even better, a way to locate the line in this file that holds the starting value of 0179 and then populates the ArrayList with the 9 elements from the file with error checking of the 0179 to confirm that it is in fact being populated from the correct line in the file. Maybe this error checking is overboard and not needed, but I am use to placing error checking into programs to maintain that they execute within their intended operating limits. Maybe this is code execution paranoia, but it was soemthing that was stated over and over by college professor for C++ to maintain error checking and never assume that its going to always run as intended.

I made a similar turn based peer to peer game using C++ many years ago that was able to be played over network between 2 computers as a final project for intermediate C++, but to avoid cheating I decided to place all the items hard CODED into the source so it was a very lengthy program in size by not using an ArrayList and pointing to a file for reference to populate the ArrayList with the data and keeping the program small. The instructor in SCORING your projects, in addition to looking at techniques used would take away points if for example he could get the game or program to crash due to poor technique when it asks for you to enter your age for example and then he would type in a non integer input etc as one student made the mistake of having this input in his program and not testing the input to be an integer within the limits of say 1 and 120, and the screen would scroll and he would instantly take away 10 points from the 100 you could have gotten etc so now your working with potential for a 90 and hopefully he doesnt find any additional flaws in the design. I got a 100 on my project because he actually looked to see if he could manipulate a data file to his benefit and the data that was shared between the 2 computers was a bunch of numbers of which I masked the numbers intentions by given them all offsets so that he couldnt look at his health on the game and then loot at the file that was ACCESSED between both systems over the network and easily make sense of it to give himself 1 million health or make the next attack an instant fatality by editing this file to have say 1 million damage when it was like 10 or 20 points of damage per hit etc with randoms for dodge, block, hit etc so that david can beat goliath if the numbers are in his favor even with weaker stats making it fun. Being that this data file needed to have the ability to be read/write from these 2 systems, the data on this file was unprotected really in its current state so if given enough time he could have figured out the offsets to decipher it and edit the file to his benefit etc.

BUT the good thing with PHP is that the data that can allow for cheating etc is all server side with the only input being form data submissions, so I just need to make sure that I dont code it with any injection attack vulnerabilities and then it should be all set.

So looking for any input people may have on this for better suggestions on doing this or if anyone has a code example that shows how to search and pick a line of data out of say a text file which populates the ArrayList that would be an awesomely big help to the roadblock I am at with handling this. Below is an example of the data file and finding say 0181 and populating the ArrayList with the data of the 9 elements is where I am stumped if this is the best method?

The data structure would be comma delimited: ( * since space delimited would be a major problem with space in description titles )

0179, Broad Axe, 1, 10, 20, 0, 0, 2, 1
0180, Heavy Sword, 1, 11, 21, 0, 0, 1, 2
0181, Bone Dagger, 2, 6, 12, 0, 0, 3, 1
0182, MYSTERY Staff, 1, 10, 20, 2, 1, 1, 0

*Note: Current plan is to get the game working with local data file etc and then later implement calls to mySQL and do away with the file containing the contents which is best for a actual transactional database to manage.Sorry I can't help. It is much to hard for me. But if it was me, I would run PHP at home, which I do for testing WordPress themes. You don't need a second computer.

Here is a article that claims you can test PHP, doing it on Apple, Linux and Windows with one PC. I( have not tried this method.)
Quote

You can easily install the Apache web server (A), MySQL (M) and PHP (P) on your laptop or home PC. The three come bundled together, referred to as either the WAMP, MAMP or LAMP according to whether you are installing them on Windows (W), a Mac (M), or Linux (L)
How to run PHP at home: WAMP, MAMP and LAMP

Hope that MIGHT help a little.
There is no arraylist in PHP. PHP arrays however are associative arrays/hashmaps, so you can use any key you want.
This loads in a file with a similar format to what you gave and creates a associative array with the key being the Item# (the first item on each line).
Code: [Select]<?php
functionreadData(datafile){
$lines=explode("\n",file_get_contents(datafile));
return$lines;
}
functionparseData(input){
hash=array();
foreach(inputas$line){
$splitline=explode(",",$line);
hash[$splitline[0]]=array_slice($splitline,1);
}
returnhash;
}
echo"begin";
$weapondata=parseData(readData("weapon.txt"))
//$weapondatacannowbelookedupwithIDnumbers.
//eg$weapondata["0179"]willreturnanarray{"BroadAxe","1","10","20","0","0","2","1"}
?>
Ideally, you would be using a separate class to store the information for each item; then you could use something like $weapondata["0179"].getDamage() or something to that effect.Quote
There is no arraylist in PHP. PHP arrays however are associative arrays/hashmaps, so you can use any key you want.

hmmm .... I found this example when looking for an arraylist for PHP at the link below using the list() function the other day and since it is termed an arraylist even though list() function I thought it was the same.

http://www.w3schools.com/php/func_array_list.asp

Thanks for providing me with code below to work with showing the explode and parse of the data. Thats a Big Help! Now beyond the roadblock I had with your help.
1508.

Solve : Can someone identify the language or encryption type??

Answer»

Hello everyone,
It's been two days since I was able to decrypt a .dms file. When I decrypted it, the below text came out:
?¨@lù?(_ ??¢?ZS>?%òÙy¸å[emailprotected]
?¨@lù?(_ ??¢?ZÄ>?%òÙy¸å[emailprotected]
?¨@lù?(_ ??¢?ZÃ>?%òÙy¸å[emailprotected]
?¨@lù?(_ ??¢?ZÉ>?%òÙy¸å[emailprotected]
?¨@lù?(_ ??¢??ÔS>?%òÙÞ¯á[emailprotected]
?¨@lù?(_ ??¢??ÔÉ>?%òÙÞ¯á[emailprotected]
?¨@lù?(_ ??¢?ÖS>?%òÙ¬ýâ[emailprotected]
?¨@lù?(_ ??¢?ÖËj>?%òÙ¬ýâ[emailprotected]
?¨@lù?(_ ??¢?Ö Ø>?%òÙ¬ýâ[emailprotected]
?¨@lù?(_ ??¢?Ö]>?%òÙ¬ýâ[emailprotected]
?¨@lù?(_ ??¢?Öï>?%òÙ¬ýâ[emailprotected]
?¨@lù?(_ ??¢?Ö}>?%òÙ¬ýâ[emailprotected]
?¨@lù?(_ ??¢?Ö$>?%òÙ¬ýâ[emailprotected]
?¨@lù?(_ ??¢?¦S>?%òÙ´ÆÄ[emailprotected]
?¨@lù?(_ ??¢??¦S>?%òÙ¨×Ä[emailprotected]
?¨@lù?(_ ??¢??¦É>?%òÙ¨×Ä[emailprotected]
?¨@lù?(_ ??¢??¦ÍfY?%òÙ¨×ÄØ?
?¨@lù?(_ ??¢??¦ÍfYþ%òÙ¨×ÄØ?l
?¨@lù?(_ ??¢YS>?%òÙ¯bã[emailprotected]
?¨@lù?(_ ??¢YÄ>?%òÙ¯bã[emailprotected]
?¨@lù?(_ ??¢YÃ>?%òÙ¯bã[emailprotected]
?¨@lù?(_ ??¢?Ò£ì>?%òÙiªä[emailprotected]
?¨@lù?(_ ??¢?¦Åµ¦?%òÙiªÄ?w
?¨@lù?(_ ??¢??Z£¥ÿ?%òÙi·å©?
?¨@lù?(_ ??¢??Z£¥ü?%òÙi·å©
?¨@lù?(_ ??¢??Z£¥`?%òÙi·å©?
?¨@lù?(_ ??¢??Z£¥¹?%òÙi·å©
?¨@lù?(_ ??¢??Z£¥û?%òÙi·å©
?¨@lù?(_ ??¢??Z£¥Q?%òÙi·å©
?¨@lù?(_ ??¢??Z£¥R?%òÙi·å©
?¨@lù?(_ ??¢??Z£¥O?%òÙi·å©

?¨@lù?(_ ??¢??Z£¥P?%òÙi·å©
?¨@lù?(_ ??¢??Z£·ú?%òÙi·å@
?¨@lù?(_ ??¢??Z£·ÿ?%òÙi·å@?
?¨@lù?(_ ??¢??Z£·ü?%òÙi·å@
?¨@lù?(_ ??¢??Z£·`?%òÙi·å@?
?¨@lù?(_ ??¢??Z£·¹?%òÙi·å@
?¨@lù?(_ ??¢??Z£·û?%òÙi·å@
?¨@lù?(_ ??¢??Z£·Q?%òÙi·å@
?¨@lù?(_ ??¢??Z£·R?%òÙi·å@
?¨@lù?(_ ??¢??Z£·O?%òÙi·å@

?¨@lù?(_ ??¢??Z£·P?%òÙi·å@
?¨@lù?(_ ??¢??Z£¢ú?%òÙi·å¶
?¨@lù?(_ ??¢??Ù,xÔ?%òÙi·ë?ì?
?¨@lù?(_ ??¢?ZS>?%òÙy¸å[emailprotected]
?¨@lù?(_ ??¢?ZÄ>?%òÙy¸å[emailprotected]
?¨@lù?(_ ??¢?ZÃ>?%òÙy¸å[emailprotected]
?¨@lù?(_ ??¢?ZÉ>?%òÙy¸å[emailprotected]
?¨@lù?(_ ??¢??ÔS>?%òÙÞ¯á[emailprotected]
?¨@lù?(_ ??¢??ÔÉ>?%òÙÞ¯á[emailprotected]
?¨@lù?(_ ??¢?ÖS>?%òÙ¬ýâ[emailprotected]
?¨@lù?(_ ??¢?ÖËj>?%òÙ¬ýâ[emailprotected]
?¨@lù?(_ ??¢?Ö Ø>?%òÙ¬ýâ[emailprotected]
?¨@lù?(_ ??¢?Ö]>?%òÙ¬ýâ[emailprotected]
?¨@lù?(_ ??¢?Öï>?%òÙ¬ýâ[emailprotected]
?¨@lù?(_ ??¢?Ö}>?%òÙ¬ýâ[emailprotected]
?¨@lù?(_ ??¢?Ö$>?%òÙ¬ýâ[emailprotected]
?¨@lù?(_ ??¢?¦S>?%òÙ´ÆÄ[emailprotected]
?¨@lù?(_ ??¢??¦S>?%òÙ¨×Ä[emailprotected]
?¨@lù?(_ ??¢??¦É>?%òÙ¨×Ä[emailprotected]
?¨@lù?(_ ??¢??¦ÍfY?%òÙ¨×ÄØ?
?¨@lù?(_ ??¢??¦ÍfYþ%òÙ¨×ÄØ?l
?¨@lù?(_ ??¢YS>?%òÙ¯bã[emailprotected]
?¨@lù?(_ ??¢YÄ>?%òÙ¯bã[emailprotected]
?¨@lù?(_ ??¢YÃ>?%òÙ¯bã[emailprotected]
?¨@lù?(_ ??¢?Ò£ì>?%òÙiªä[emailprotected]
?¨@lù?(_ ??¢?¦Åµ¦?%òÙiªÄ?w
?¨@lù?(_ ??¢??Z£¥ÿ?%òÙi·å©?
?¨@lù?(_ ??¢??Z£¥ü?%òÙi·å©
?¨@lù?(_ ??¢??Z£¥`?%òÙi·å©?
?¨@lù?(_ ??¢??Z£¥¹?%òÙi·å©
?¨@lù?(_ ??¢??Z£¥û?%òÙi·å©
?¨@lù?(_ ??¢??Z£¥Q?%òÙi·å©
?¨@lù?(_ ??¢??Z£¥R?%òÙi·å©
?¨@lù?(_ ??¢??Z£¥O?%òÙi·å©

?¨@lù?(_ ??¢??Z£¥P?%òÙi·å©
?¨@lù?(_ ??¢??Z£·ú?%òÙi·å@
?¨@lù?(_ ??¢??Z£·ÿ?%òÙi·å@?
?¨@lù?(_ ??¢??Z£·ü?%òÙi·å@
?¨@lù?(_ ??¢??Z£·`?%òÙi·å@?
?¨@lù?(_ ??¢??Z£·¹?%òÙi·å@
?¨@lù?(_ ??¢??Z£·û?%òÙi·å@
?¨@lù?(_ ??¢??Z£·Q?%òÙi·å@
?¨@lù?(_ ??¢??Z£·R?%òÙi·å@
?¨@lù?(_ ??¢??Z£·O?%òÙi·å@

?¨@lù?(_ ??¢??Z£·P?%òÙi·å@
?¨@lù?(_ ??¢??Z£¢ú?%òÙi·å¶
?¨@lù?(_ ??¢??Ù,xÔ?%òÙi·ë?ì?

Can you help me to UNDERSTAND what it exactly is?
Thank you for the assistance,
Riccardo
Are you playing with an AMIGA computer? Where did this data come from? To me it looks like 25 CHARACTER number sequence. Number sequences because of the same characters leading in and more random looking at the end of the character strings. Additionally its a list of numbers because static characters like "Customer Name" usually wont repeat within a save file to make for repetition of leading characters like you have, however database DUMP FILES can have repeating characters strings vs numbers, but this doesn't look at all like a dump file, it looks like a list of numbers.

My thoughts are that the data is something like this when its decrypted:

1234567890000000077765451
1234567890000000008999346
1234567890000006782901823
1234567890000000056739029

Knowing where this data came from may help identify what it actually is.

1509.

Solve : need help with mysqli?

Answer»

What I'm trying to do is select once from the dropdown and use the selection
to update the numbersdb database via the submit button. Thanks for your HELP.
Code: [Select]&LT;?php
$dbconnect=mysqli_connect('localhost','root','');
mysqli_select_db($dbconnect,'numbersdb')ordie("Unabletoselectdatabase");
$taxrate=(isset($_POST['submit']))?mysqli_real_escape_string($dbconnect,$_POST['taxrate']):'';
$id=(isset($_POST['id']))?mysqli_real_escape_string($dbconnect,$_POST['id']):'';
$result=mysqli_query($dbconnect,"SELECT*FROMnumbdata");
if(!empty($_POST['update_taxrate'])){
$update=mysqli_query($dbconnect,"UPDATEnumbdataSETtaxrate='$taxrate'WHEREid='$id'");
echo"Taxratehasbeenset...";
}
?>[/color]
Code: [Select][color=red]<!DOCTYPE html>
<html>
<HEAD>
<title>Select taxrate</title>
<style type="text/css">
body {
background: #cff;
}
form {
text-align: center;
}
</style>
</head>
<body>
<form name="taxset" action="<?phpecho$_SERVER['PHP_SELF'];?>" method="post">
<p><label>Select state/rate</label><p>
<select name="taxrate">
<option value="0.04000" SELECTED>4% Alabama</option>
<option value="0.05600">5.6% Arkansas</option>
</select>
</p>
<!--<p><label>Update taxrate</label>
<input type="text" name="update_taxrate">-->
<p><input type="submit" name="submit" value="update"></p>
</form>
</body>
</html>
[/color]

1510.

Solve : Graphics Programming Advice?

Answer»

Good morning FOLKS,

A newby here, so a big thank you, in advance to everyone. Much appreciated!!.

Please FORGIVE me if this post is in the wrong "place".

Some years ago now, I studied and done (did ?) some COMPUTER Programming........Graphics mainly.......in BASIC (Basica, GW-Basic mainly) and Pascal (Borland Turbo Pascal).

I still do have a small collection of such *.bas and *.pas source code.

Want to teach Sons now Graphics Programming, by re-visiting those source code examples that I do have, plus introduce other source code examples..........Yep, these 2 languages are older now I know, but still want to teach our Sons. Have DOSbox and BTP 7.0 and a few different flavors of BASIC (GW, Qbasic, QB64, Dark Basic etc etc).

My inquiry is does anyone have any *.bas and *.pas graphics demos source code that they can share ?.........things beyond just the basic LINE, circle etc etc commands.........things like plasma, fire, 3D, advanced use of line, circle, putpixel, animation etc etc.

Yep, I have consulted Mr, Google, but not a great deal of source codes in BAS and PAS alas :-(.

Thank you so much again!!,
Ian.You might want to try QBasic.

Here is a blog post that might inspire you or give you ideas, which specifically discusses teaching QBasic to a child:

http://www.nicolasbize.com/blog/30-years-later-qbasic-is-still-the-best/

For graphics-related BASIC code samples, you might try these:

http://www.petesqbsite.com/sections/tutorials/graphics.shtml

e.g.: http://www.petesqbsite.com/sections/tutorials/tuts/tavares_graphics.txt

1511.

Solve : [Lua] Splitting strings again?

Answer»

So I have a table that contains tables that holds a line from a TEXT file, so if the file's first line is "0,0,0,50" then table = { 1 = {a = "0,0,0,50"} 2 = { a = "LINE 2"} 3 = { .....etc. } I want to seperate t[1][a] by commas and STORE each of them in their respective places within the table.

so what I want to do is have it like this:
table = {
1 = {
a = "0,0,0,50"
1 = 0
2 = 0
3 = 0
4 = 50
}
}

What I have so far:
function split_comma_String()
local b = tablelength(t)
print(t[1].a)
print(b)
repeat
local k = 1
local tak = t.a
print(tak)
for v in string.gmatch(tak, "%w+") do -- error in "%w+" Want to seperate by comma (,)
t[k] = v
k = k + 1
print(b,b,t[k])
end
b = b - 1
until b == 0
end

Nothing that I put in the quotes seems to work. If someone could explain why this is not working that would be very helpful.
Oops, I forgot to put it in quotes, so the syntax got all messed up.
Code: [Select]function split_comma_String()
local b = tablelength(t)
print(t[1].a)
print(b)
repeat
local k = 1
local tak = t[b].a
print(tak)
for v in string.gmatch(tak, "([^,]+)") do -- error in "\,+" Want to separate by comma (,)
t[b][k] = v
k = k + 1
print(b,b,t[b][k])
end
b = b - 1
until b == 0
end

Well I got it to split correctly by using "[^,]+" (though I have no idea why that works). But now it won't set the value into the table.

current code:
Code: [Select]function split_comma_String()
local b = 1
--print(t[1].a)
--print(b)
repeat
local k = 0
local tak = t[b].a
--print(tak)
for v in string.gmatch(tak, "[^,]+") do
_G["t["..b.."]" ..k] = v -- Not working
k = k + 1
print(v ,"t", b, k, t[b][k])
end
print("")
b = b + 1
until b == t_length
end

1512.

Solve : JS alternative to BASIC's GOSUB?

Answer» Not a programmer - at least since QBASIC. Just looking for a simple JS SCRIPT that does what GOSUB did in BASIC. It will be used to call a series of JS routines.
Thanks in advance
Start here:
http://www.youtube.com/watch?v=_cLvpJY2deo

http://javascript.about.com/od/reference/g/jsubroutine.htm

Quote from: Geek-9pm on November 17, 2013, 12:30:34 AM
Start here:
http://www.youtube.com/watch?v=_cLvpJY2deo


Not sure I have the time or BANDWIDTH to learn the nitty-gritties of JS, but that is one great tutorial! I got engrossed in it and used up half my daily bandwidth before I REALIZED it. (I'm on dorky Hughes.net).

Anyhow, thanks for the link. If I find the time I may be downloading those and get to studying. I really love the way that FELLOW is doing that.
Quote from: Salmon TROUT on November 17, 2013, 02:43:04 AM
http://javascript.about.com/od/reference/g/jsubroutine.htm

Thank you for the info..
1513.

Solve : text to mp3?

Answer» HI, I have downloaded an mp3 (ckmp3)that says "RETURN to homepage" and I'm TRYING to code so that when I click on my home IMAGE I get that mp3 saying "return to homepage".
Any ADVICE? I'm trying this.
=============================================================================

src="house.jpg" height=75 width=75 alt="image of home">[/url]

==========================================================================
thanks, Charlie
1514.

Solve : Re: my computer is dead?

Answer»

What OS are you running; Windows - - ? Can you give me any more details? Sounds like you might have to re-format and reload Windows but again, maybe not.
BarkleyYou know, this would be better posted in the proper SECTION. What has this question got to do with programming?nothing to do with programing as you can see it has been here for 6 daysThen why post it here?well as you will NOTICE I havent sence the 18th when I found out it was not the programming sorry this bothered you so much if it did then dont read it
Can you TRAVEL back in time and prevent me from reading it, then?grow up a little it was purely a MISTAKE on my part sorry if I have wasted your time ! but obviously I dont know that much about computers or I would of known that it was a power issue and not programming I have deleted the topic so no need to replyI'll still tell mommy.I let Sensuous know it was the wrong area to post waaaay back. The original post was deleted to clear confusion which created more confusion when Barkleyc responded. You may notice that Sensuous did indeed repost the question in the appropriate area. Some of you need to calm down. Remember, I'm the one who is supposed to be the jerk around here what with my sarcasm and all.I'm calm. Just a bit of confusion. Breath in........ and relax.......

1515.

Solve : Good sites for learning JavaScript??

Answer» ANYONE know any good sites for learning the ins and out of JavaScript? Free is best! Thank you!LOTS of good stuff at Youtube as WELL as one of my favorite sites is W3 Schools as LINKED here: https://www.w3schools.com/js/DEFAULT.asp
1516.

Solve : I really need some help here?

Answer»

I have a message that reads attention onsignal chck input signalconnection or follow power save mode has been enable how do i fix this
We're gonna need some information. What is your OS? What are you doing when you get this message? Does this have ANYTHING to do with Programming?dont know what OS is and dont really know if it has anything to do with programming I was on the net and my computer shut off and that message APPEARED on the screen
OS means your operating system. Are you using XP or win 98 or mac or whatever? If it's not a programming issue (by that I mean if you aren't writing a program using code) then you'd be better off posting in a different area. By posting your QUESTION here, you run the risk of only those PEOPLE interested in programming seeing the post. I'd post your question in the Microsoft section.thank you for the info ill post it in the other section

1517.

Solve : Script not working!?

Answer»

It ends whenever the command 'goto' is involved

@echo off

title %name% - The Fishing Game V 0.2(alpha)

color 0f
pause
echo --------------
echo AlexSoft Copyright-2013
echo --------------
pause
color 0c
echo ERROR LOADING TFG.mp3
pause
color 0f
echo __________________
echo.
echo ~THE FISHING GAME~
echo.
echo __________________
echo.
echo (Future ASCII ART HERE)
echo Type Start to start game, type exit to quit.
echo Type Plan to view planned ideas.
echo Contact me: (TBA)
echo Remember, as of V 0.2, you cannot SAVE the game!
if %input%==Start goto Gamestart

:Gamestart
echo You are waking up
pause
echo You are up
pause
echo You yell hello
pause
echo No response.
pause
echo You don't remeber what happened, how you got here, or even your name.
pause
echo Then you think about how you need to survive.
echo.
echo You arn't trained to survive in the wild.
pause
echo But then you remember, you're not trainined to do anything, heck, you arn't even 'trained' to know your name.
pause
echo You say to yourself, "Now what?"
pause
echo To start making a shelter, press A
echo To look around for any others, press B
if %input%==A goto A1
if %input%==B goto B1

:A1

echo You look around for a good place to make shelter.
pause
echo You find a good spot under a large rock for sleeping, but its too narrow to make a shelter in.
pause
echo To make a shelter here, Press A
echo To KEEP looking, Press B
if %input%==A goto A2
if %input%==B goto B2

:B1

echo While looking, you were attacked by 2 wild wolves.
pause
echo You have died...
pause
goto options


:A2

echo Once you're in, you feel something large on your leg.
echo.
echo It turns out that hole was a home to a nest of scorpions, which, so far luck for you, havn't attacked.
pause
echo You slowly move out safely.
pause
echo but your not safe
echo They have swarmed out of the ledge and you run
echo Though you dont know that it is the animal instinct is to kill something running from you, because only prey would run from you.
pause
echo As you may have seen where this is going, you felt a sharp pain in your leg.
pause
echo To great relief, it was only a thorn.
echo But, while you take that thorn out, a scorpion is under you.
pause
echo This time it stings you...
pause
echo You have died...
pause
goto options

:B2

echo Sorry, this is as far as we have scripted!
echo.
echo retry for a different story/ending!
pause
echo Goodbye
exit
Test it a little bit at a time.
Your IF statement with not work if there is no input.
What does %input% mean? Where was it set?
It closes down at any goto command.

revised script(still doesn't work)

@echo off

title %name% - The Fishing Game V 0.2(alpha)

color 0f
pause
echo --------------
echo AlexSoft Copyright-2013
echo --------------
pause
color 0c
echo ERROR LOADING TFG.mp3
pause
color 0f
echo __________________
echo.
echo ~THE FISHING GAME~
echo.
echo __________________
echo.
echo (Future ASCII ART HERE)
:options
echo Type New to start game, type exit to quit.
echo Type Plan to view planned ideas.
echo Contact me: (TBA)
echo Remember, as of V 0.2, you cannot save the game!
set /p you=">"
if %you%==New goto Gamestart

:Gamestart

cls
echo You are waking up
pause
echo You are up
pause
echo You yell hello
pause
echo No response.
pause
echo You don't remeber what happened, how you got here, or even your name.
pause
echo Then you think about how you need to survive.
echo.
echo You arn't trained to survive in the wild.
pause
echo But then you remember, you're not trainined to do anything, heck, you arn't even 'trained' to know your name.
pause
echo You say to yourself, "Now what?"
pause
echo To start making a shelter, press A
echo To look around for any others, press B
set /p you=">"
if %you%==A goto A1
if %you%==B goto B1

:A1

cls
echo You look around for a good place to make shelter.
pause
echo You find a good spot under a large rock for sleeping, but its too narrow to make a shelter in.
pause
echo To make a shelter here, Press A
echo To keep looking, Press B
set /p you=">"
if %you%==A goto A2
if %you%==B goto B2

:B1

cls
echo While looking, you were attacked by 2 wild wolves.
pause
echo You have died...
pause
ping localhost -n 2 >nul
goto options


:A2

cls
echo Once you're in, you feel something large on your leg.
echo.
echo It turns out that hole was a home to a nest of scorpions, which, so far luck for you, havn't attacked.
pause
echo You slowly move out safely.
pause
echo but your not safe
echo They have swarmed out of the ledge and you run
echo Though you dont know that it is the animal instinct is to kill something running from you, because only prey would run from you.
pause
echo As you may have seen where this is going, you felt a sharp pain in your leg.
pause
echo To great relief, it was only a thorn.
echo But, while you take that thorn out, a scorpion is under you.
pause
echo This time it stings you...
pause
echo You have died...
pause
ping localhost -n 2 >nul
goto options

:B2

cls
echo Sorry, this is as far as we have scripted!
echo.
echo retry for a different story/ending!
pause
ping localhost -n 2 >nul
goto options


It works for me... can you provide more information? Where exactly does it crash? Does it not even start up correctly?

Also you are missing an "options" label, - This might be the cause of your issue.I deleted your duplicate post. Please do not post the same question more than once. Thank you.This should fix most of your problems:

@echo off

title %name% - The Fishing Game V 0.2(alpha)

color 0f
pause
echo --------------
echo AlexSoft Copyright-2013
echo --------------
pause
color 0c
echo ERROR LOADING TFG.mp3
pause
color 0f
echo __________________
echo.
echo ~THE FISHING GAME~
echo.
echo __________________
echo.
echo (Future ASCII ART HERE)
:options
echo Type New to start game, type exit to quit.
echo Type Plan to view planned ideas.
echo Contact me: (TBA)
echo Remember, as of V 0.2, you cannot save the game!
set /p you=">" goto checkmenu

:checkmenu
if %you%==new goto Gamestart
if %you%==exit goto closecmd
:end


:Gamestart

@echo off

cls
echo You are waking up
pause
echo You are up
pause
echo You yell hello
pause
echo No response.
pause
echo You don't remeber what happened, how you got here, or even your name.
pause
echo Then you think about how you need to survive.
pause
echo You arn't trained to survive in the wild.
pause
echo But then you remember, you're not trainined to do anything, heck, you arn't even 'trained' to know your name.
pause
echo You say to yourself, "Now what?"
pause
echo To start making a shelter, press A
echo To look around for any others, press B
set /p you=">" goto checkshelter

:checkshelter
if %you%==A goto A1
if %you%==B goto B1
if %you%==a goto A1
if %you%==b goto B1
:end


:A1

cls
echo You look around for a good place to make shelter.
pause
echo You find a good spot under a large rock for sleeping, but its too narrow to make a shelter in.
pause
echo To make a shelter here, Press A
echo To keep looking, Press B
set /p you=">" goto checkmake

:checkmake
if %you%==A goto A2
if %you%==B goto B2
if %you%==a goto A2
if %you%==b goto B2
:end


:B1

cls
echo While looking, you were attacked by 2 wild wolves.
pause
echo You have died...
pause
ping localhost -n 2 >nul --> what is the point of this line?
goto options


:A2

cls
echo Once you're in, you feel something large on your leg.
echo.
echo It turns out that hole was a home to a nest of scorpions, which, so far luck for you, havn't attacked.
pause
echo You slowly move out safely.
pause
echo but your not safe
echo They have swarmed out of the ledge and you run
echo Though you dont know that it is the animal instinct is to kill something running from you, because only prey would run from you.
pause
echo As you may have seen where this is going, you felt a sharp pain in your leg.
pause
echo To great relief, it was only a thorn.
echo But, while you take that thorn out, a scorpion is under you.
pause
echo This time it stings you...
pause
echo You have died...
pause
ping localhost -n 2 >nul --> What is the point of this line?
goto options

:B2

cls
echo Sorry, this is as far as we have scripted!
echo.
echo retry for a different story/ending!
pause
ping localhost -n 2 >nul
goto options

:options
cls
echo here is where your options would be if it was scripted
pause
exit


:closecmd
exit


I have made bold what I changed, and italicized a line for your answer. I would also add more "cls" so that the user doesn't have to look at TONS of text at once. Easier on the eyes.

Let me know if you have any questions.It helps if you can break your code in little sections. That is how you try are possibilities for an IF statement without going into the whole page of code.
Look t this:
Code: [Select]set /p you=">"
if %you%==A goto A1
if %you%==B goto B1
exit
:A1
echo A1
This code may or may not work. It will work for A, but not for B
Do you see why?Quote from: Geek-9pm on November 20, 2013, 12:41:11 PM

It helps if you can break your code in little sections. That is how you try are possibilities for an IF statement without going into the whole page of code.
Look t this:
Code: [Select]set /p you=">"
if %you%==A goto A1
if %you%==B goto B1
exit
:A1
echo A1
This code may or may not work. It will work for A, but not for B
Do you see why?

I know this wasn't directed at me - but why doesn't that work? Shouldn't it check if %you% is A. If it is, then goto A1. But if not, shouldn't it move to the next line and check if %you% is b. Then goto B1 if it is, but if not just move on and exit?

I just saw that it wasn't working so I made a case to check with both instead and it worked.
1518.

Solve : Run FTP from vbscript?

Answer»

Greetings all. I am trying to get a vbscript to run ftp command. If I run "ftp -s:c:\test\ftp.txt>c:\test\ftp_out.txt" (without the quotes) from the command prompt, it works like a charm. The only thing c:\test\ftp.txt is doing is downloading dir contents to text file c:\test\ftp_out.txt. Below are the lines in c:\test\ftp.txt (host, user, pass changed to protect the innocent)

open hostname
username
password
dir "*.txt"
bye


However, if I try to run from a vbscript, it only flashes the command window for a split second, then STOPS. This is how I am trying to run it in vbscript...

set WShell = CreateObject("WScript.Shell")
FTP = WShell.Run("ftp -s:c:\test\ftp.txt>c:\test\ftp_out.txt")

very simple, but does not behave the same as when I type directly in the command prompt. I have tried setting a variable equal to the string between the quotes to no avail, and have tried setting various parts as variables, but no success. I believe it must be something simple I am overlooking. Any help would be GREATLY appreciated. Thank you.

GregA quick check on Google shows many are using Vb script to run the FTP command.
Did you look at any of those items?
This one LOOKS nice.
http://www.naterice.com/articles/51
FTP Upload and FTP Download with VBScript

EDIT: Why not just use one of the many free FTP clients that can run from the command line? The use of Vb Script seems rater involved. Or is the objective just to prove it can be done?Thank you for the reply. I should have clarified that I am able to FTP files using VBScript, i.e. 'get', 'mget', etc with no problem. My issue here is that when I try to direct the results of 'dir' to a local text file, something is causing it to not work. I can take out the redirect from the shell command, and the vbscript performs as would be EXPECTED. For example this works, and, again, the only thing c:\test\ftp.txt is doing is issue a dir command...

set WShell = CreateObject("WScript.Shell")
FTP = WShell.Run("ftp -s:c:\test\ftp.txt")

Notice that I have taken out the '>c:\test\ftp_out.txt', so the dir list is only displayed on screen. However, when I put back the '>c:\test\ftp_out.txt', so that my VBScript code ends up being...

set WShell = CreateObject("WScript.Shell")
FTP = WShell.Run("ftp -s:c:\test\ftp.txt>c:\test\ftp_out.txt")

No bananas. I would expect the dir output would be written to text file c:\test\ftp_out.txt, but it is not. I can open a command prompt, and enter the exact contents of the shell command and it works, in that the dir output are correctly written to the text file. I guess a broader question would be to ask why would a command, in this case "ftp -s:c:\test\ftp.txt>c:\test\ftp_out.txt", work at the command prompt, and not via a VBScript shell?

Thank you.I don't know why, but adding "%comspec% /c" to the string being shelled made it work.

This works...
FTP = WShell.Run("%comspec% /c ftp -s:c:\test\ftp.txt>c:\test\ftp_out.txt")


This does not work...
FTP = WShell.Run("ftp -s:c:\test\ftp.txt>c:\test\ftp_out.txt")

It seems like maybe I am expicityly telling the shell to run the FTP commands with cmd.exe. However, if I take out the redirect I don't need to include %comspec%. Not sure why, but it works now. Thanks.

Glad you got it by yourself.
The Shell command inside of Vb Script and some other languages is not a true call to the one command processor. It is not re entrant. Use of comspec is needed to explicitly them the script how to find the command interpreter.
This might help explain what is the matter.
COMMAND.COM, SHELL and COMSPEC
BTW: You did not say what OS you have. The 64 bit Windows 7 can not run 16 bit programs.

The comspec is needed if other instance of the interpreter has not closed.
Use comspec to execute bat files without waiting for last to complete

Does that help any?Yes, it all seems a little bit less muddy now. In fact, I had ALREADY found the first link you posted by using the search on this forum. This is my first foray into using FTP via VBScript, so I figured I would have some kinks to work out. And in answer to one of your previous questions, this is just to see if it can be done. I am a SAS user, and for some reason, when I try to use the FTP methods in SAS, it just crashes, but I am able to have SAS call VBScript, which I can then use to FTP. Kind of round about way of doing it, but it works. Using any third party software is not an option for me, as my company uses something called "Chameleon FTP" as an add on to our 3270 emulator. I can't even edit my environment strings without an admin allowing it. So, for anyone not having edited their environment strings as I have done, when they enter 'FTP' at the command prompt, the Chameleon application opens up. For some odd reason, though, if they shell a FTP command like I am doing, Chameleon does not run, and they are able to do what I am doing. I am using 32 bit windows 7, and so far, it all seems to be working. Anyhow, thank you for the tips.

Greg

1519.

Solve : setting colors on coumuter?

Answer»

I recently replaced the hare drive and now my COLOR settings are way off. I have no idea how to CORRECT.
could someone please tell me how to FIX my color settings. than youA bit of INFORMATION could help. I'm assuming that you mean the colours on your counter in an app you made are not correct (I get this from your subject line). Why not go into your code and CHANGE the font colour?

1520.

Solve : Need help with Simple Java Program?

Answer»

Here is what I have to do for my class http://pastebin.com/tegBmTe5. Could someone maybe teamview me to HELP me out because I am pretty lost.Are you serious?

Do your own homework.Quote from: GOOGLE on November 25, 2013, 12:04:07 PM

Are you serious?

Do your own homework.

You need to stop making posts like this, Google.
Quote from: Google on November 25, 2013, 12:04:07 PM
Are you serious?

Do your own homework.

While we don't assist with homework here, it's not your place to be RUDE to PEOPLE. Knock it off.
1521.

Solve : when any key is pressed?

Answer»

I need a powershell script which will detect for about 3 MINUTES if any key on keyboard is pressed. When it is it MAKE a txt file.
O have this script but it doesn't work I tested it on windows 7 and windows 10
Any idea about it?
Code: [Select]1..100000 | ForEach-Object {
"I am at $_"
if ($Host.UI.RawUI.KeyAvailable)
{
New-Item E:\key.txt -ItemType "file" -Force
BREAK
}

Start-Sleep -SECONDS 0.3
}On the PC and most other devices, a low level code handles the keyboard.
You need to re think your idea. Programs to manage a keyboard are very special.

1522.

Solve : VB programming for AutoCAD?

Answer»

Can someone point me to a good tutorial on creating an Autocad DRAWING thru VB? I know scripting, but that is not what I am talking about. Also, I am not talking about the VB EDITOR in Autocad. I am talking about a stand-alone APPLICATION which outputs a FINISHED Autocad-format DWG file.

1523.

Solve : C LIB Help?

Answer»

Hi,
My first attempt to add a FUNCTION to the C LIB, fail's to compile:

Code: [Select]/* test.c */
#include <stdio.h>
#include <stdarg.h>
#include “test.h” /* DSP header file */

#define maxent (sm) (sm->txt->hn.numelem)

#define MIN(a,B) ((a) < (b) ? (a) : (b))
void displist (menudesc *sm) ;

void displist (menudesc *sm)

/*
Parameters:
*sm * pointer to DSP structure
*/
{
int i,m,n,x,y,col;
strlist tl;

/* calculate's MIN between DSP area and DSP items */

n= MIN(maxent (sm) - sm->scrofs,sm->area) ;

m = n+sm->scrofs; /* add minimum to _s offset */
selectwindow (sm->w) ; /* select as mounted */
clrwin (NULL, 0); /* CLEAR */

tl = getstrptr(sm->scrofs +1, sm->txt); /* point to first item */
/* write */
for (i = sm->scrofs, x=0, y=0, col=1; (i<m); i++) {
prthz (x,y,tl->dn.elem.data, sm->w->wndatr,tl->dn.elem.len) ;
tl = tl->dn.next; /* get 1st */
if (++y >= sm->nrows) { /* goto 2nd */
y = 0; col++;
x = colx(col, sm) ; /* DETERMINE loc */
}
}
}



The line compiler APPEARS to flag states:

Code: [Select] n= MIN(maxent (sm) - sm->scrofs,sm->area) ;

The C compiler reports:
Quote


C2064 : ERROR : term does not evaluate to a function


I'm stumpt and would appreciate any help with this C syntax, since I'm in transition from BASIC.
thx
qito
1524.

Solve : VB Dir$ Function?

Answer»

Has anyone GOT this to display subdirectories? I am USING a list box, and I have USED vbDirectory and vbSystem ETC but they don't seem to work. Am I FORGETTING something? I also want it to display the contents of the tempory internet files folder, but it doesn't work. I am thinking this is because it is a hidden folder, is there a way round this?

1525.

Solve : Python programs won't run.?

Answer»

I had a power outage and temperatures a bit below freezing in my home. My computer was exposed to those temps for a short while. When I started it up, Windows 7 had to repair some problems. Since then, any program I write in Python will not run in IDLE or otherwise. I have uninstalled Python and re-installed several times. I have tried to run down every piece of the program and delete it also (I might not be good at that). Still nothing. The older programs that I wrote before the recent weather work fine. Anything new will not run. My computer seems to be working fine otherwise.What version of Python do you have?
Also, are you running 32 bit or 64 bit?
Because there are different ways people use Python, some more detail is needed.
Does the tone of this page represent the way you do Python?

Python on Windows FAQ


Is the problem only with any recent files you made into an EXE?
Or is it also with even the source files will not compile?

My best guess is that some of your files were corrupted by the power surge. The files may have hidden characters that prevent the interpreter from parsing correctly. You may need to pass your source files through some kind of filter.
I was using version 2.5.something because I don't know a lot and was just tinkering at first. When it started functioning improperly, I replaced it with 2.7.something. I was downloading from python.org. Someone suggested that I try ActiveState. I downloaded the newest version of 2.7 that they have. A new python program will run now but still will not run in IDLE. I have tried 32 bit and 64.I'm afraid Windows or my hard drive is messed up. I got a 4 line program to run. Anything beyond that gives me a syntax error without even running the 4 lines I proved worked earlier (they were input lines).Post some examples of working and non-working script code.

Working:

width = input('What is the width of the film you will be using in inches? : ')
lengthfilmfeet = input('What is the length of the film in FEET?: ')
lengthfilminches = float(lengthfilmfeet) * 12.0
print lengthfilminches
input('Press : ')


Not Working:

width = input('What is the width of the film you will be using in inches? Add a decimal place to your entry please. : ')
lengthfilmfeet = input('What is the length of the film in feet? Remember to add a decimal place to your entry. : ')
lengthfilminches = float(lengthfilmfeet) * 12.0
1000s = float(lengthfilminches) * float(width) / 1000.0
print 1000s
input('press : ')

I get an immediate syntax error and it closes. Neither of those will run in IDLE.This turned out to be a user error on my part. I spent 13 hours trying to solve this today. So there.Quote from: Liquidius on December 09, 2013, 04:36:16 AM

This turned out to be a user error on my part.

Care to share?
First: I did have a syntax error. I don't remember exactly what it was.
Second: I was selecting "Python shell" from the run menu equating that with "Run in shell"
Third: I made that mistake only minutes after Windows performing repairs. So my line of reasoning was diverted to that.
Fourth: When I re-installed Python, I upgraded and there might have been a CHANGE in appearance.
Fifth: Some other excuse.Quote from: Liquidius on December 09, 2013, 06:45:49 AM
First: I did have a syntax error. I don't remember exactly what it was.
it was the variable name "1000s", which isn't a valid variable name.



Quote from: Liquidius on December 09, 2013, 06:45:49 AM
First: I did have a syntax error. I don't remember exactly what it was.
Second: I was selecting "Python shell" from the run menu equating that with "Run in shell"
Third: I made that mistake only minutes after Windows performing repairs. So my line of reasoning was diverted to that.
Fourth: When I re-installed Python, I upgraded and there might have been a change in appearance.
Fifth: Some other excuse.

Summary: I don't care about wasting everybody's TIME.
Quote from: BC_Programmer on December 09, 2013, 09:24:47 AM
it was the variable name "1000s", which isn't a valid variable name.

Indeed.

How hard is it to understand this?

Variable names can be arbitrarily long. They can contain both letters and numbers, but they have to begin with a letter.


Well, it was a goo read anyway.
Toe Err is Human -
computers never forgive.Gentlemen, it was the variable indeed, but I think there might have been some change in the Run menu from 2.5 to 2.7. That might not be the case though. I did state that I don't know much.

This turned out to be a great exercise in resourcefulness. I went into 3 IRC chat rooms, emailed 2 groups, queried 3 friends, posted in a forum, did a system restore and became more familiar with a registry. Maybe you can appreciate that. Maybe, also, you can appreciate my embarrassment after discovering that I was making a beginner's mistake, and that I had wasted everyone's time as a RESULT...and, perhaps, you will note that I took the time to mark this as "resolved" and confess my ignorance. I was tired after 13 hours and agitated and in an incommunicable state. Perhaps you'll forgive. I did thank you GUYS, I think. Thanks again for the attempts.
1526.

Solve : php prepared statements?

Answer»

gave up on this for awhile but thought to try the prepared statements again. I'm trying to select RECORDS from database to REMEMBER info, click on and GO to the target and update the date last used, visit count, time VISITED and if the info hasn't been saved, save it. Below is my latest feeble attempt. I'm hoping for advice
-------------------------------------------------------------------------------------------



echo '
', date('m/d/y'), '';
$con = new mysqli('localhost', 'root', 'cookie', 'homedb');
if ($con->connect_error)
{ echo 'Cannot Connect to MYSQL: ', $con->connect_error(); }
else
{
echo '
E-Mail Account:


-- select --';
$targets = $con->query('SELECT target FROM emailtbl');
while ($row = $targets->fetch_array(MYSQLI_ASSOC)) echo '
', $row['target'], '';
echo '

';
}
?>


$con = new mysqli('localhost', 'root', 'cookie', 'homedb');
if ($con->connect_error)
{ echo 'Cannot Connect to mySQL: ', $con->connect_error(); }
else
{
if (isset($_POST['target']))
{
$stmt = $con->prepare('
SELECT target, purpose, username, password, emailused, lastused, visit-count, time-visited, saved
FROM emailtbl
WHERE target = ? ');
$stmt->bindValue(1, $_POST['target']);
$stmt->execute();
if ($row = $stmt->fetch())
{
echo '
Purpose Username Password E-Mail Used Last Used visit count time visited Saved
', $value, '
';
}
else echo 'No Results Found';
}
else echo 'No valid "target" for Query';
}
$stmt = $con->prepare('
UPDATE emailtbl
SET lastused = NOW(), visit-count = visit-count + 1,
time-visited = time-visited + 1
WHERE target = ? ');
$stmt->bindParam(s, $_POST['target']);
$stmt->execute();
echo $stmt->error ? '

Lastused update query error: ' . $stmt->error . '

' : ( $stmt->affected_rows > 0 ? '

Success! Updated ' . $stmt->affected_rows . ' records.

' : '

FAILED! No records updated.

');
?>

=====================================================================================
below is the result
------------------------------------------------------------------------------------
', date('m/d/y'), ''; $con = new mysqli('localhost', 'root', 'cookie', 'homedb'); if ($con->connect_error) { echo 'Cannot Connect to mySQL: ', $con->connect_error(); } else { echo ' E-Mail Account:
'; } ?> connect_error) { echo 'Cannot Connect to mySQL: ', $con->connect_error(); } else { if (isset($_POST['target'])) { $stmt = $con->prepare(' SELECT target, purpose, username, password, emailused, lastused, visit-count, time-visited, saved FROM emailtbl WHERE target = ? '); $stmt->bindValue(1, $_POST['target']); $stmt->execute(); if ($row = $stmt->fetch()) { echo ' '; do { echo ' '; foreach ($row as $value) echo ' '; echo ' '; } while ($row = $stmt->fetch()); echo '
Email Activity for ', htmlspecialchars($_POST['target']), ' Purpose Username Password E-Mail Used Last Used visit count time visited Saved
', $value, '
'; } else echo '
No Results Found
'; } else echo '
No valid "target" for Query
'; } $stmt = $con->prepare(' UPDATE emailtbl SET lastused = NOW(), visit-count = visit-count + 1, time-visited = time-visited + 1 WHERE target = ? '); $stmt->bindParam(s, $_POST['target']); $stmt->execute(); echo $stmt->error ? '
Lastused update query error: ' . $stmt->error . '
' : ( $stmt->affected_rows > 0 ? '
Success! Updated ' . $stmt->affected_rows . ' records.
' : '
FAILED! No records updated.
'); ?>
1527.

Solve : An unusual problem......?

Answer»

As part of an experiment I'm doing, I have to generate random word lists. I already have the WORDS; they just need to be put in a random order. There are 40 lists with 14 words in each list.

I HAVE NO IDEA HOW TO DO THIS. I tried using MS Word and Excel, but neither seem to have a "randomize" feature. It seems like such a simple thing, but I can't find an answer anywhere on Google either. I'm not a PROGRAMMER, though I can write some basic html when I need to. Anyone have any IDEAS? I've asked all my friends, and no one seems to have a clue.

If anyone out there can help me with this, you'll be my hero.

JBtry using Visual basic and using a list BOX

1528.

Solve : Raw estimate of budget needed?

Answer»

Dear COMPUTER Hope forum,

The reason I'm posting this topic is because I'm making a business report.

The website I NEED to make an estimate of is www.twitch.tv

It doesn't need to be the cost used to make the whole website, but an avarage of cost or man hours estimate of how much it takes to make a STREAMING platform like that. (the SOFTWARE behind it)

HOPEFULLY you can give me some pointers of what and how much it takes to create software like this in order to broadcast streaming footage on a website,

Sincerely


1529.

Solve : keypress or mouse move exe?

Answer»

I need a small program which will detect if any key from A to Z or 0 to 9 is pressed than it makes a txt file, after that if nothing happend for 30 minutes it delete that file and it should work as process.
And there is config file to set PATH and time.
I get this in C# but it doesn't work, can someone look at it and see why it is not working, please?
here is C# version

Code: [SELECT]using System.Runtime.InteropServices;
using System.Threading.Tasks;



[DllImport("user32.dll")]
static extern bool GetLastInputInfo(ref LASTINPUTINFO plii);

[StructLayout(LayoutKind.Sequential)]
struct LASTINPUTINFO
{
PUBLIC static readonly int SizeOf = Marshal.SizeOf(typeof(LASTINPUTINFO));

[MarshalAs(UnmanagedType.U4)]
public UInt32 cbSize;
[MarshalAs(UnmanagedType.U4)]
public UInt32 dwTime;
}

static uint GetLastInputTime()
{
uint idleTime = 0;
LASTINPUTINFO lastInputInfo = new LASTINPUTINFO();
lastInputInfo.cbSize = (uint)Marshal.SizeOf(lastInputInfo);
lastInputInfo.dwTime = 0;

uint envTicks = (uint)Environment.TickCount;

if (GetLastInputInfo(ref lastInputInfo))
{
uint lastInputTick = lastInputInfo.dwTime;
idleTime = envTicks - lastInputTick;
}

return ((idleTime > 0) ? (idleTime / 1000) : 0);
}

private uint _lastInputTime;
private bool _idle = false;
private string _fileName;
private int _idleTime = 1800;

void Main()
{
VAR cfg = File.ReadAllLines("nastavitve.cfg");
_fileName = cfg[0];
int.TryParse(cfg[1], out _idleTime);

_lastInputTime = GetLastInputTime();

while (true)
{
var inputTime = GetLastInputTime();

if (_idle && inputTime - _lastInputTime < 1)
{
_idle = false;

File.Create(_fileName).Close();
}

if (!_idle && inputTime - _lastInputTime > 5)
{
_idle = true;

if (File.Exists(_fileName))
File.Delete(_fileName);
}

Thread.Sleep(1000);
}
}

and here is version for compiling with VS

Code: [Select]using System;
using System.IO;
using System.Runtime.InteropServices;
using System.Threading;

namespace ConsoleApp1
{
class Program
{
[DllImport("user32.dll")]
static extern bool GetLastInputInfo(ref LASTINPUTINFO plii);

[StructLayout(LayoutKind.Sequential)]
struct LASTINPUTINFO
{
private static readonly int SizeOf = Marshal.SizeOf(typeof(LASTINPUTINFO));

[MarshalAs(UnmanagedType.U4)]
public uint cbSize;
[MarshalAs(UnmanagedType.U4)]
public uint dwTime;
}

static uint GetLastInputTime()
{
uint idleTime = 0;
LASTINPUTINFO lastInputInfo = new LASTINPUTINFO();
lastInputInfo.cbSize = (uint)Marshal.SizeOf(lastInputInfo);
lastInputInfo.dwTime = 0;

uint envTicks = (uint)Environment.TickCount;

if (GetLastInputInfo(ref lastInputInfo))
{
uint lastInputTick = lastInputInfo.dwTime;
idleTime = envTicks - lastInputTick;
}

return ((idleTime > 0) ? (idleTime / 1000) : 0);
}

private static uint _lastInputTime;
private static bool _idle = false;
private static string _fileName;
private static int _idleTime = 1800;

static void Main()
{
var cfg = File.ReadAllLines("nastavitve.cfg");
_fileName = cfg[0];
int.TryParse(cfg[1], out _idleTime);

_lastInputTime = GetLastInputTime();

while (true)
{
var inputTime = GetLastInputTime();

if (_idle && inputTime - _lastInputTime < 1)
{
_idle = false;

File.Create(_fileName).Close();
}

if (!_idle && inputTime - _lastInputTime > _idleTime)
{
_idle = true;

if (File.Exists(_fileName))
File.Delete(_fileName);
}

Thread.Sleep(1000);
}
}
}
}

1530.

Solve : Any good hexadecimal tutorials??

Answer»

Hai.....is there any good sites that teach hexadecimal...i know theres alot ALREADY but STILL very confusing coz all of it don't SHOW good example of applying or using it.

e.g-if i have a program called hex-editor...how do i use
it to EDIT ANOTHER program and how do apply
the tutorials from sites for editing the hexadecimal
value in a program.

1531.

Solve : [Lua] If-then always returning false?

Answer»

Maybe some fresh eyes can see what's wrong here. In the function Write_Map() the 2nd If tree is always PROVIDING false, whereas the 3rd works the way it should. It is suppose to grab the coordinates from pt.txt and then display any that are withing a -7 -> 7 (y) and -7 -> 7 (x) area around you (at pos.x , pos.y , pos.z). It works for everything accept displaying a point from pt.

There should be rings of points.
Code: [Select]args = {...}
pt_length = 0
pos = {}


function round(num, idp)
local mult = 10^(idp or 0)
return math.floor(num * mult + 0.5) / mult
end

function readALL(file) -- by lhf on stackoverflow.com
local f = io.open(file, "rb")
local content = f:read("*all")
f:close()
return(content)
end

function split_space_String(s)
pt = {}
local k = 1
for v in string.gmatch(s, "([^\N]+)") do
if v ~= nil then
if v ~= "\n" then
pt[k] = { a = v }
pt_length = pt_length + 1
k = k + 1
end
end
end
end

function split_comma_String()
local B = 1
repeat
local k = 1
local tak = pt[b].a
if tak ~= nil then
for v in string.gmatch(tak, "[^,]+") do
_G["tmp" ..k] = v
k = k + 1
end
-- x y z
pt[b] = { tmp1, tmp2, tmp3 }
print(b," ",pt[b][1],pt[b][2],pt[b][3])
end
b = b + 1
until b == pt_length
end


function Write_Map()
local w = 0
local y_l=7
local y = pos.y + 7
print(" -7-6-5-4-3-2-1 0+1+2+3+4+5+6+7")
repeat -- LOOP 1
local x = pos.x - 7
if string.len(y_l) == 1 then
if y_l ~= 0 then
y_l = "+" ..y_l
else
y_l = " " ..y_l
end
end
io.write(y_l .." ")


repeat -- LOOP 2
os.execute("title " ..x .."," ..y)
print(pt[2][1] .."," ..pt[2][2])
print(x .."," ..y)
local a = 2
local w = 0

repeat -- LOOP 3

if x == pt[a][1] then
if y == pt[a][2] then
io.write("X ")
w = 1
end
end

if x == pos.x then
if y == pos.y then
if w ~= 1 then
io.write("S ")
w = 1
end
end
end

if x == 0 then
if w ~= 1 then
io.write("| ")
w = 1
end
end

if y == 0 then
if w ~= 1 then
io.write("- ")
w = 1
end
end

a = a + 1
until a == pt_length-- Loop 3
os.execute("PAUSE")
if w ~= 1 then io.write("0 ") end
w = 0
x = x + 1
until x == pos.x + 8 -- Loop 2
io.write("\n")
y = y - 1
y_l = y_l - 1
until y == pos.y - 8 -- Loop 1
end





split_comma_String(split_space_String(readALL("pt.txt")))

while true do
pos.x = round(tonumber(readALL("pos_x.txt")),0)
pos.y = round(tonumber(readALL("pos_y.txt")),0)
pos.z = round(tonumber(readALL("pos_z.txt")),0)

os.execute("title " ..pos.x .."," ..pos.y .."," ..pos.z)
Write_Map()
os.execute("timeout /t 2 /nobreak >NUL")
os.execute("cls")
end

pt.txt (the first hundred lines or so)
Code: [Select]
330,300,-300,
328,310,-296,
328,310,-304,
328,304,-290,
328,304,-310,
328,296,-290,
328,296,-310,
328,290,-296,
328,290,-304,
324,318,-300,
324,300,-282,
324,300,-318,
324,282,-300,
322,320,-296,
322,320,-304,
322,304,-280,
322,304,-320,
322,296,-280,
322,296,-320,
322,280,-296,
322,280,-304,
320,322,-296,
320,322,-304,
320,320,-290,
320,320,-310,
320,310,-280,
320,310,-320,
320,304,-278,
320,304,-322,
320,296,-278,
320,296,-322,
320,290,-280,
320,290,-320,
320,280,-290,
320,280,-310,
320,278,-296,
320,278,-304,
318,324,-300,
318,300,-276,
318,300,-324,
318,276,-300,
310,328,-296,
310,328,-304,
310,320,-280,
310,320,-320,
310,304,-272,
310,304,-328,
310,296,-272,
310,296,-328,
310,280,-280,
310,280,-320,
310,272,-296,
310,272,-304,
304,328,-290,
304,328,-310,
304,322,-280,
304,322,-320,
304,320,-278,
304,320,-322,
304,310,-272,
304,310,-328,
304,290,-272,
304,290,-328,
304,280,-278,
304,280,-322,
304,278,-280,
304,278,-320,
304,272,-290,
304,272,-310,
300,330,-300,
300,324,-282,
300,324,-318,
300,318,-276,
300,318,-324,
300,300,-270,
300,282,-276,
300,282,-324,
300,276,-282,
300,276,-318,
296,328,-290,
296,328,-310,
296,322,-280,
296,322,-320,
296,320,-278,
296,320,-322,
296,310,-272,
296,310,-328,
296,290,-272,
296,290,-328,
296,280,-278,
296,280,-322,
296,278,-280,
296,278,-320,
296,272,-290,
296,272,-310,
290,328,-296,
290,328,-304,
290,320,-280,
290,320,-320,
290,304,-272,
290,304,-328,
290,296,-272,
290,296,-328,
290,280,-280,
290,280,-320,
290,272,-296,
290,272,-304,
282,324,-300,
282,300,-276,
282,300,-324,
282,276,-300,
280,322,-296,
280,322,-304,
280,320,-290,
280,320,-310,
280,310,-280,
280,310,-320,
280,304,-278,
280,304,-322,
280,296,-278,
280,296,-322,
280,290,-280,
280,290,-320,
280,280,-290,
280,280,-310,

pos_x.txt
Code: [Select]325
pos_y.txt
Code: [Select]300
pos_z.txt (rounded by round() to -300)
Code: [Select]-300.25
It turns out that the values in pt were saved as strings, so the statement was comaring strings to numbers and coming out false. to fix this I used
Code: [Select]if tonumber(x) == tonumber(pt[a][1]) then
if tonumber(y) == tonumber(pt[a][2]) then
if tonumber(pos.z) == tonumber(pt[a][3]) then
io.write("X ")
w = 1
end
end
end
Glad CH was able to help you. This tends to happen a lot. I'll post a question, and then 5-10 min later, when I go away to do something else, I'll come up with an answer.Yes, no charge for out service.
Come back often.Quote from: Lemonilla on December 14, 2013, 03:15:28 PM

This tends to happen a lot. I'll post a question, and then 5-10 min later, when I go away to do something else, I'll come up with an answer.
You successfully rubber-ducked the problem.
1532.

Solve : java programming?

Answer»

i m studying java programming,i m using a win 95 , I ve just installed a jdk1.2.2 compiler , but every time i want to COMPILE for example :
class HalloWorld
{
public static void MAIN (String args[])
{
system.out.println(HalloWorl !);
}
}
------------------------------------------------------------------------
Error can´t read .1 Error
------------------------------------------------------------------------
maybe problems with the :autoexe.bat
with : PATH and CLASSPATH
what can i do ?
thanx
Are you writing the code in notepad or are you using a Java tool for your coding.Hi John20004,

your coding is wrong. at the line system.out.println you should type System.out.println("HALLO World");

caps locks matters, and you miss out the " " inverted commas.

you need to read up some more books or visit some websites about Java.

http://java.sun.com/docs/books/tutorial/getStarted/application/index.htmlYou need Dr. Java for your JAVA IDE so you can test / compile your class.Hi John, if ur compilation error says "cannot read file" and then the filename, make sure that u have typed the classname properly. If however the problem continues make sure u set the classpath and the path in the autoexec.bat file. hope u'll succeed. sumon

1533.

Solve : running java files in windows background?

Answer»

hi i am working on a PROJECT which NEEDS me to run a JAVA file as a background process in windows. moreover the file MUST run continously. looking for some help in this regard. THANK u.

1534.

Solve : Restart network PCs by using Java?

Answer»

Dear All,

I Can restart my PC using Java but i want to give that command to any PC on my network as i have about 500 or more , so can any one help me in detailed way
I created a simple form with two text fields number one takes the number of seconds it will takes and the second one takes the host-name of any machine and at last the Button which execute the restart command and as i said it works properly with my PC without using the second text field but i don't know the right command to make it restart the network PC and can't convert my code to do that.
here is may code inside the Button below , so kindly if you can do that write my code again with the right way:


Runtime runtime = Runtime.getRuntime();
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));

//System.out.print("Enter No. of Seconds after which You want your Computer to Shutdown :");
String a;
String h;
try {
a = txt1.getText();
h = txt2.getText();
long r = Integer.parseInt(a);
Process proc = runtime.exec("shutdown -r -t"+r);
} catch (Exception ex) {
JOptionPane.showMessageDialog(null, ex);
}

System.exit(0);Abo-Zead,
What you want to do is too much like malware.
Yes, yu can power down your own PC because you are the owner and administrator.
Shooting down a remote machine invokes security rules.

To shut down 500 PCS, you NEED permission to control each one. That kind of power is restricted for general use. In other words, you can not do if.

How to shut down your own PC with software is well DOCUMENTED. The documents never tell you how to shut down hundreds of PCs. If there is such a program, such a script must certainly malware and can not be reveled on this forum.

Noe, having said that, here is info from CH archives:
How to remotely shutdown another Windows computer
Quote

Tip
You need administrative privileges to access and shut down the computer remotely to complete the following steps.
So there.

Please read the WHOLE thing. It is very accurate and update.

Can you explain why you are doing this?Geek-9pm
Thanks for your response but I already created a batch file to do what i want like remote registry CHANGE , restart one Or couple Or even all of them as i want with considering the restart time for each PC and some simple command and have no restrictions in my company
but i want to do that with Java program instead of batch files , so can you help me.I Found some people were talking about the use of the server and client and other people talked about the use of socket service and i wasn't know about its really and after i knew it i didn't like it , so I thank Allah for guiding me to the truth of that issue and as i was wanted to give the order to my computer directly without any mediator like any service then the operating system and network protocols taking the responsibility for sending my command to other PC on my network then the other PC directly execute my command as it using the same operating system that exactly what i want
here is my last code below if it helping any one latter

String Time = "0";
Time = txt1.getText();
String HostName = txt2.getText();
String shutdownCmd = "shutdown -r -t "+Time+" -m \\\\"+HostName;
try {
Process p = Runtime.getRuntime().exec(shutdownCmd);
} catch (IOException ex) {
Logger.getLogger(frmRestart.class.getName()).log(Level.SEVERE, null, ex);
}
1535.

Solve : Random_Shuffle with single space in the list of characters to shuffle C++?

Answer»

Been playing around with Random_Shuffle again and trying to figure out a way to add a single space into the string to shuffle it as a single character space that can end up in any element location as a result of the random_shuffle. The C++ instructions that I am working with are like the following. But there is no escape character sequence that I can find to add a single space to the string to be shuffled.

I found a reference to isspace which could be used for a character substitution in place of space such as space detected pass a character as ö for space in the input string that works with this shuffle below if ö was added to the string to shuffle to pair up as a character match. https://www.geeksforgeeks.org/isspace-in-c-and-its-application-to-count-whitespace-characters/

Quote

string str="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklm [emailprotected]#$%^&*()_-+=?<>:\\/~.,;";

random_shuffle(str.begin(), str.end())

Wasn't sure if maybe an unusual to English character may need to be used such as ö added to the list for substitution for space, and ö is used for a space translation in the output, or if there is a method to add the ASCII equivalent to space character in the string above such as ASCII code 0x20. Been trying a few things and compiler not happy with trying to force it to accept a single space to the string str. I haven't gone through the method yet of adding an ö to the string to be shuffled and perform a space to ö translation yet because I have been known to do things the hard way and perhaps there is a better way than a character substitution, however if the character substitution method if the best way to get it to accept adding a space to the shuffle, then i can go that route. Unless I am misunderstanding, does
Code: [Select]string str="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklm [emailprotected]#$%^&*()_-+=?<>:\\/~.,; ";

That not work? Just adding a space to the end of the string itself? Thanks for help with this BC. That's the one thing I didnt try was a space without an escape character.

That fixed the compile issue, however now trying to figure out a way to fix another part of PROGRAM that broke. The part that broke looks at the length of the string that is input and it seems that the first space that is entered it thinks is the end of the string and so a string of ABC DE it thinks is 3 characters in length long instead of 6, so the space entry confuses the string length instruction that I have. It measures proper length of characters when all bound tight without SPACES, so curious how to fix this string length issue where a single space is seen as end of string?

Here is more code snippet to show what I have going on: ( location=i-1; is used to point to the correct array element where ARRAYS start with first element at 0. )
Also hoping its not confusing having a lot going on with little commenting. I had to print it out and write on paper with colored pens showing WHATS passed to what to keep track of it where values are passed between arguments of functions as its slightly SPAGHETTI.

Quote
cout<<"Enter String\n";
string MyString="";
cin>>MyString;
string s(MyString);
char p[s.length()];

int i;

// assigning value to string s
int n = s.length();

// declaring character array
char user_array[n + 1];

// copying the contents of the
// string to char array
strcpy(user_array, s.c_str());

for (int X = 0; X < n; X++){
//Pass to Char Array
}

for (i = 0; i < sizeof(p); i++) {
p = s;
}

location=i-1;

string str="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklm [emailprotected]#$%^&*()_-+=?<>:\\/~.,;{}[]'|\"` ";
reading a string from standard input via the << operator only reads to the first whitespace character, so the length is not incorrect- the string is not what you expected.

If you want to read an entire line you can use std::getline.

Code: [Select]getline(cin, MyString);
Sweet! Thanks for the help BC. And brought your thanked to 1111
1536.

Solve : run my program?

Answer» HELLO Sir/Madam

I am narasiman.
I WANT to know how to RUN my own program before
the bootstrap loader program, i.e, OPERATING System.
suggest me.
1537.

Solve : Small script required?

Answer»

Need to identify when a USB device has been plugged in, look for a file on the device, if file found then copy contents of device to a sub folder called current date, inside the folder named the same as the file looked for.

e.g.

Name of File: File1
if found, should copy device contents to a folder D:\File1\01022020

Any suggestions on where to start.The script would be one that could be used for malicious intent. A computer with this running as a service seeing any USB device and copying all contents sounds like data theft.

What is the intent of this to where it can be used in a non-malicious way?

Looking for a file found can all so easily be replaced with a wildcard instruction to grab all data and steal data!

Any computer that is used by others with this would basically steal information from them UPON inserting a USB stick.

A better approach would be that your working in IT and need to track users and PLACE a script on the thumb drive that reports HOME with a file that needs to be saved with a date/time folder from a user instead of the other way AROUND. This way only those USB sticks run the script when the users WANT it to, instead of trying to potentially hide that data is being copied from USB stick. The users should really have control of what data they are sharing and a script this way would do that and a DOS SHELL window would pop up for a moment and then disappear after the copy process complete.

1538.

Solve : php coding?

Answer»

my objective is to select records from database to remember info, click on and go to the target and
update the date last used, visit count, time visited and if the info hasn't been SAVED, save it.
I do this in html, see the records, click on a button and go to target of interest... using Xampp
server w/databases, and access thru php I can update(crud).

My Xammp is running, my database is confirmed, my php doesn't seem to work in accessing the records.
I've tried other forums to no avail.
Below is my latest feeble attempt. I'm hoping for adviceI have a screenshot of resulting
display, any help? c'mon, there's room.
===========================================================
here's my code - hey I feel the lauhter
---------------------------------------




echo "";echo $date->format('d-m-Y H:i:s a');echo "";
$id="''";
$con=mysqli_connect("localhost","root","","homedb");

// ============== check connection

if(mysqli_errno($con))
{echo "Can't Connect to mySQL:".mysqli_connect_error();}
else
{echo "";}

// ==========This creates the drop down box using records in the table

echo "";
echo ''.'---select email account ---'.'';
$query = mysqli_query($con,"SELECT target FROM lookuptbl");
$query_display = mysqli_query($con,"SELECT * FROM lookuptbl");
while($row=mysqli_fetch_array($query))
{ echo "".$row['target']
.'';}
echo '';
?>



error_reporting(E_ALL ^ E_NOTICE);
// error_reporting(0);
$con=mysqli_connect("localhost","root","","homedb");
if(mysqli_errno($con))
{echo "Can't Connect to mySQL:".mysqli_connect_error();}
if(isset($_POST['target']))
{
$id = $_POST['id'];
$name = $_POST['target'];
$fetch="SELECT target, purpose, username, PASSWORD, emailused, visits, lastdate, lasttime, saved
FROM lookuptbl WHERE target = '".$name."'";
$result = mysqli_query($con,$fetch);
if(!$result)
{echo "Error:".(mysqli_error($con));}

// =============================== this displays the table

echo ''.''.'

'. 'email menu'. '
'.''.''.''.'
' ''.''.'
'.''.''.''.'';
// while($data = mysqli_fetch_row($fetch))
while($data=mysqli_fetch_row($result))
{echo ("
");}
echo '
'.'target'.''.'purpose'.''.'username'.''.'password'.''.'emailused'.''.'lastdate'.''.'lasttime'.''.'saved'.'
$data[0]$data[1]$data[2]$data[3]$data[4]$data[5]$data[6]$data[7]$data[8]
'.'
';
}
?>
Why did you pick PHP?
Are you a PHP programmer?
If so, what tools do you use?
Quote from: Geek-9pm on February 19, 2020, 11:22:04 AM
Why did you pick PHP?
Are you a PHP programmer?
If so, what tools do you use?

Please, answers npt ?? what would pick and why, Are you a PHP programmer?
If so, what tools do you use?
Are you a PHP programmer?
If so, what tools do you use?

I wonder if the fact that win7 is no longer supported is cause for PHP not to work.
Checking "php error logs" gets "cannot find path". Installed new xampp. still no PHP?You are directly loading the PHP file into the browser. You need to access it through your server. Usually that is via http://localhostDear topic POSTER;
it seems that nobody is giving you a direct answer to your question. Judging by the appearance of things it seems that you are not an experienced PHP programmer.
This gives rise to the question about why you chose PHP to solve the database problem.
Although PHP is used widely for creating special programs, most users do not need to have a special program created by themselves solve the problem. INSTEAD, most ordinary users just use something somebody else had already prepared and just adapted to their own needs.
You seem to indicate that you need to update the database and you need to have some way of editing it according to when something was updated. That sort of thing is often DONE by people using some form of SQL. So that makes me wonder what kind of programming experience you have and what kind of work do you do.
Or perhaps I should ask, is this for your own pleasure. If so, perhaps we should concentrate on what your needs are rather than giving you specific help on PHP syntax and usage. Perhaps it is not really need to write a program to get what you want. Perhaps you could give us some clues as to what kind of database you're working on and whether not to doing this for yourself or somebody else. It looks like you have copied somebody else's code. Is that true? And did you get permission to copy the code and posts it somewhere else?
There are many experienced people year on this forum that would like to help you, but you make it difficult without providing more information about your background and your objectives. In any case, we do not to homework for people. Please help us understand about who you are and what your objectives are. This has nothing to do with your privacy, rather it helps us to understand what kind of background and experience you have and whether or not it would be wise for us to try to coach you in PHP usage.
Have you had experience with managing databases? If so how large a better database and what sort of information for you handling?
Again, these questions are to help others know how to respond to your request.

In order to help you quickly I have written this post in my speech recognition program. So please excuse some bad grammar or spelling mistakes
1539.

Solve : VB5 Beep??

Answer»

I'm PROGRAMMING with Visual Basic 5. The "Beep" Command doesn't PRODUCE a sound.

I'm running on XP, home edition. All my volume controls in the control panel are SET at max.

NatGoto your sounds settings and make sure that "Default Beep" has a sound associated with it. That is the beep that the system will do. Chance are you have "default beep" set to noneThanks mims...that's a good start. The problem SEEMS to be that my computer has no "Default" sound title, such as Announce", "Startup", etc.

I changed a *.WAV t o [default.wav] but that didn't work.
nat

1540.

Solve : php time and php date?

Answer»

I need to update a date used field (lastused) and time used field (time). how to relate with code?
Hey there,

This is a pretty cool website. Not had much time to look at the coding though, but hope this LINK helps,

https://www.w3schools.com/php/php_date.asphi guys, thought I'd try this. Trying to display records in database. Below is my code: Help?
-------------------------------------------------------


<center>lookup Link List</center>


<?php
error_reporting(E_ALL ^ E_NOTICE);
// error_reporting(0);
<?php
include('lookupdb-connect.php');
$query = "SELECT * FROM `lookuptbl` WHERE `TARGET` = `$target` ORDER by target Asc";
$result = $mysqli->query($query) or die($mysqli->error.__LINE__);
while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC))
{
echo '<table style="border:1px solid RED;">',
'<TR align="center" >
<td>', $row['target'], '</td>
<td>', $row['purpose'], '</td>
<td>', $row['user'], '</td>
<td>', $row['password'], '</td>
<td>', $row['email'], '</td>
<td>', $row['sec?'], '</td>
<td>', $row['secAns'], '</td>
<td>', $row['visits'], '</td>
<td>', $row['lastdate'], '</td>
<td>', $row['lasttime'], '</td>
<td>', $row['saved?'], '</td>
</tr>
</table>';
?>
</body></html>
-----------------------------------------------
this is displayed:

lookup Link List

query($query) or die($mysqli->error.__LINE__); while ($row = mysqli_fetch_array($result, MYSQLI_ASSOC)) { echo '', '
', $row['target'], ' ', $row['purpose'], ' ', $row['user'], ' ', $row['password'], ' ', $row['email'], ' ', $row['sec?'], ' ', $row['secAns'], ' ', $row['visits'], ' ', $row['lastdate'], ' ', $row['lasttime'], ' ', $row['saved?'], '
'; ?>

Hey there,

Hope you got this one working. Sorry nobody has got back to you. If you're not still having issues with this can you close the thread please.

your code should have " " and where you have , should be a stop like . and also should have echo at the start.

so

Code: [Select]<td>', $row['target'], '</td>
Should be

Code: [Select]echo "<td>".$row['target']."</td>";
I'm sure by now you have had the answer, so hope all is well with you, and if you could close the thread please that WOULD be great, thanks!

1541.

Solve : Eclipse IDE?

Answer»
Hey there,

Just a quickie. Installing Eclipse IDE. Looks like its a stand alone that just runs like a portable app. Is that correct or should it still be in my uninstall programs?

Just asking because as I have a slight ISSUE. It's when I open it and try using the tutorial for "create a Hello World SWT application". When I open this it asks me to "Open the Java perspective, however its not there. Also doing the import of the "Import the SWT project from target platform using the PDE... well I follow the instructions and again I don't have it there.

Any info how to use Eclipse optimally, because I don't think I've done it correctly, would be great thanks!

I have done a simple hello world and it runs fine. Although when compiling to a .jar file it compiles but when I run it it doesn't seem to run. I can write it in notepad++ and save as .java and run javac on it and it's okay that way. I just want to use Eclipse as EFFECTIVELY as I can to build up my java skills though.

thanks!


The code I was trying to get working was as below, but it says that Display and Shell cannot be resolved to a type.

Code: [Select]public class MySWT {

public static void main(String[] args) {

Display display = new Display();
Shell shell = new Shell(display);
shell.setText("Hello world!");
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();}

}

}
If you don't have a Java Perspective VISIBLE in Window->Open Perspective (including checking the list in "Other..." then you may have DOWNLOADED a copy of Eclipse that was not intended for Java development.

As for Display and Shell, you need to add a reference to the SWT jar file. It should be in the plugins directory in the eclipse directory. (org.eclipse.swt.jar)

Hi there,

Thanks Dave. Will give ANOTHER download a try and see what happens. I'll close the thread just now and re-open if need further assistance.

Cheers mate!

Sorry meant BC not Dave, was doing another post at the same time, sorry about that!
1542.

Solve : Script files?

Answer»

I am trying to write a script for a NT4.0 server to map drives for users, depending on what groups they are MEMBERS of. I cannot find the PROPER syntax for these IF statements and group names.

For example
IF member == group net use h: \\servername\dir

where member == group means to "If the member logging in is in this group"

I am unsure of the syntax for member == group.

Can anyone help me?I don't think that will work, but try the tool mentioned in this article:
http://www.winnetmag.com/Articles/Index.cfm?ArticleID=5869
hope that helps, GL (good luck cuz im lazy now )I'd SAY just have the batch file call at vbs that would give you a LOT more capabilities

For instance, to map a drive:

Dim net, shell
set net = Wscript.CreateObject("Wscript.Network")
set shell = Wscript.CreateObject("Wscript.Shell")
net.MapNetworkDrive "X:", "\\computer\share", true, net.username

and there are hundreds of sites out there with the functions to check membership in WSH.

1543.

Solve : Password In A Bat File?

Answer»

Hello, i need help with the code:

@ECHO OFF
set tries=3
set password=PaSsWoRd
:checker
if %tries% EQU "0" goto :EXIT
Echo You have %tries% attempts!
color 5
set /P pass= Enter Password:
if /I %pass% EQU %password% (echo Secret_Message| clip
) else (set /a tries=%tries% -1 goto :checker)
EXIT
exit
_______________________________________ __________________________________
When i WRITE a wrong password i get a "Missing operator." ERROR. But when i write the right password it works.
I want the program to ask for a password then check it and if it's the right password then change the clipboard, if the password is wrong the 1st time go BACK and put the password again,the 2nd time the same and the 3rd to close.

Thanks in advance. The missing operand is an ampersand.

Code: [Select]) else (set /a tries=%tries% -1 & goto :checker)

There is also no exit after 3 attempts. When I tested your code, I was informed I had -6 attempts.
FYI: using the /i switch on the if is case insensitive. This would make PaSsWoRd and password equal; your choice

This may help:
Code: [Select]@echo off
setlocal enabledelayedexpansion
set pswd=PaSsWoRd

for /l %%i in (3, -1, 1) do (
echo You Have %%i Attempts LEFT
set /p pass=Enter Password:
if /i !pswd!==!pass! (echo Secret Message | clip) & goto continue
if %%i==1 echo Failed Security Check & exit /B
)
:continue

Good luck.

1544.

Solve : check port at some web?

Answer»

any software can intro me to check the web's port??
actually... i got the web IP... i jsut need the port...
i have TRY to use proxyhunter to check it... but FAILED..
anymore powerfull software can intro PLS...try using the wininet control, you could create an array of ports, then loop through it using the control to check each port. It will return true or false if the connection is MADE.

1545.

Solve : Old computer experts wanted?

Answer»

here. https://www.cnn.com/2020/04/08/business/coronavirus-cobol-programmers-new-jersey-trnd/index.htmlDo you want experts in old computers or old experts in computers? There is a difference. By the way, I fall into both categories having had 50 years in the COMPUTER INDUSTRY and the TEACHING of I.T.

1546.

Solve : VB6 Text files?

Answer»

I need to WRITE a vb script that will extract a string from a text file. The only problem is that I'm having trouble LOADING the text file. I can get the string easily enough with len() and mid() statements, but how the *censored* do you load or open a text file inside runtime?USE the Open dialog control.you need to use the open command.

Here are a couple examples:

open file, read 1st line into variable "data"
Code: [Select]
Open (App.Path & "\filename.txt") For Input As #1
Line Input #1, Data
Close #1
msgbox data


Open file, run through the file doing something to each line:
Code: [Select]
Open (App.Path & "\filename.txt") For Input As #2
Do Until EOF(2)
Line Input #2, grpfor
msgbox grpfor
Loop
Close #2

1547.

Solve : Write a YAML file inside GITLAB to call batch file?

Answer»

I want to call it from YAML FILE inside GITLAB

I have tried LIKE this, .gitlab-ci.yml YAML file:

Code: [Select]Windows:
SCRIPT:
- call: ci\CheckStatus.bat init
- call: ci\CheckStatus.bat BUILD
tags:
- windows
But it is giving me error as :
Found errors in your .gitlab-ci.yml:
jobs:windows:script config should be a STRING or an array containing strings and arrays of strings
Your quick response will be appreciated.

1548.

Solve : Microsoft Access?

Answer»

Hey people,

I'm PUTTING together this applicatino at WORK using MS Access and I've got a button on there that I would like to have the image of change depending on a value in one of my tables.

Does anybody know how to do this? I have made a entry in my table Tabel1 and its a number, basically I want the image to change depeding on what number is in the value of it. The options are 0, 1 and 2.

What I'm after is something like:

IF value in Table1 = 0 THEN image of button = redlogo.bmp
IF value in Table1 = 1 THEN image of button = amberlogo.bmp
IF value in Table1 = 2 THEN image of button = greenlogo.bmp

I know the above is pretty much USELESS PSEUDOCODE but its just a guide.

ThanksI think it's something like buttonX.image = blah or buttonX.background= blah or buttonX.backgroundimage = blah. When you put the button name then the '.' a list of AVAILABLE options should pop up, scroll through that for ideas.I'd say create the button at runtime.

headstart:

http://www.vbexplorer.com/VBExplorer/vb_feature/april2000/april2000.asp

1549.

Solve : Get characters from a String?

Answer»

Does anyone know how to GET single characters, or two characters at a TIME(small string), from a string?

ex. Gettting 25 from "version_25"

Thought of the split function but didn't really work...

Thanks everyone!!!!
SORRY, this is for Visual Basic 6.0 by the way... i forgot to mention it Dim AnyString, MyStr
AnyString = "Hello World" ' Define string.
MyStr = Right(AnyString, 1) ' Returns "d".
MyStr = Right(AnyString, 6) ' Returns " World".
MyStr = Right(AnyString, 20) ' Returns "Hello World".

there is also a "Left" command as well that works the same way, except REVERSED and there is a mid function:

Dim MyString, FirstWord, LastWord, MidWords
MyString = "Mid Function Demo" ' Create text string.
FirstWord = Mid(MyString, 1, 3) ' Returns "Mid".
LastWord = Mid(MyString, 14, 4) ' Returns "Demo".
MidWords = Mid(MyString, 5) ' Returns "Function Demo".

1550.

Solve : Visual Basic-REGISTRY USAGE?

Answer»

does anyone know how to use the Registry class in VISUAL basic?

For example, where(Hkey/blabla) to save the key?

Any help would be greatly APPRECIATED, thanks everyonehttp://msdn.microsoft.com/library/default.asp?url=/library/en-us/dv_vstechart/html/vbtchaccessingregistrywithvisualbasicnet.aspUse the following module (its broken up into multiple parts because this forum will not allow me to post a larger post

Code: [Select]
Declare Function RegOpenKeyEx Lib "advapi32.dll" Alias "RegOpenKeyExA" (ByVal hKey As Long, ByVal lpSubKey As String, ByVal ulOptions As Long, ByVal samDesired As Long, phkResult As Long) As Long
Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hKey As Long) As Long
Declare Function RegCreateKey Lib "advapi32.dll" Alias "RegCreateKeyA" (ByVal hKey As Long, ByVal lpSubKey As String, phkResult As Long) As Long
Declare Function RegDeleteKey Lib "advapi32.dll" Alias "RegDeleteKeyA" (ByVal hKey As Long, ByVal lpSubKey As String) As Long
Declare Function RegQueryValueEx Lib "advapi32.dll" Alias "RegQueryValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, ByVal lpData As String, lpcbData As Long) As Long
Declare Function RegQueryValueExA Lib "advapi32.dll" (ByVal hKey As Long, ByVal lpValueName As String, ByVal lpReserved As Long, lpType As Long, ByRef lpData As Long, lpcbData As Long) As Long
Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, ByVal lpData As String, ByVal cbData As Long) As Long
Declare Function RegSetValueExA Lib "advapi32.dll" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, ByRef lpData As Long, ByVal cbData As Long) As Long
Declare Function RegSetValueExB Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hKey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal dwType As Long, ByRef lpData As Byte, ByVal cbData As Long) As Long

Const ERROR_SUCCESS = 0&
Const ERROR_BADDB = 1009&
Const ERROR_BADKEY = 1010&
Const ERROR_CANTOPEN = 1011&
Const ERROR_CANTREAD = 1012&
Const ERROR_CANTWRITE = 1013&
Const ERROR_OUTOFMEMORY = 14&
Const ERROR_INVALID_PARAMETER = 87&
Const ERROR_ACCESS_DENIED = 5&
Const ERROR_NO_MORE_ITEMS = 259&
Const ERROR_MORE_DATA = 234&

Const REG_NONE = 0&
Const REG_SZ = 1&
Const REG_EXPAND_SZ = 2&
Const REG_BINARY = 3&
Const REG_DWORD = 4&
Const REG_DWORD_LITTLE_ENDIAN = 4&
Const REG_DWORD_BIG_ENDIAN = 5&
Const REG_LINK = 6&
Const REG_MULTI_SZ = 7&
Const REG_RESOURCE_LIST = 8&
Const REG_FULL_RESOURCE_DESCRIPTOR = 9&
Const REG_RESOURCE_REQUIREMENTS_LIST = 10&

Const KEY_QUERY_VALUE = &H1&
Const KEY_SET_VALUE = &H2&
Const KEY_CREATE_SUB_KEY = &H4&
Const KEY_ENUMERATE_SUB_KEYS = &H8&
Const KEY_NOTIFY = &H10&
Const KEY_CREATE_LINK = &H20&
Const READ_CONTROL = &H20000
Const WRITE_DAC = &H40000
Const WRITE_OWNER = &H80000
Const SYNCHRONIZE = &H100000
Const STANDARD_RIGHTS_REQUIRED = &HF0000
Const STANDARD_RIGHTS_READ = READ_CONTROL
Const STANDARD_RIGHTS_WRITE = READ_CONTROL
Const STANDARD_RIGHTS_EXECUTE = READ_CONTROL
Const KEY_READ = STANDARD_RIGHTS_READ Or KEY_QUERY_VALUE Or KEY_ENUMERATE_SUB_KEYS Or KEY_NOTIFY
Const KEY_WRITE = STANDARD_RIGHTS_WRITE Or KEY_SET_VALUE Or KEY_CREATE_SUB_KEY
Const KEY_EXECUTE = KEY_READ

Dim hKey As Long, MainKeyHandle As Long
Dim rtn As Long, lBuffer As Long, sBuffer As String
Dim lBufferSize As Long
Dim lDataSize As Long
Dim ByteArray() As Byte

'This constant determins wether or not to display error messages to the
'user. I have set the default value to False as an error message can and
'does become irritating after a while. Turn this value to true if you want
'to debug your PROGRAMMING code when reading and writing to your system
'registry, as any errors will be displayed in a message box.

Const DisplayErrorMsg = False

Code: [Select]

Function SetDWORDValue(SubKey As String, Entry As String, Value As Long)

Call ParseKey(SubKey, MainKeyHandle)

If MainKeyHandle Then
rtn = RegOpenKeyEx(MainKeyHandle, SubKey, 0, KEY_WRITE, hKey) 'open the key
If rtn = ERROR_SUCCESS Then 'if the key was open successfully then
rtn = RegSetValueExA(hKey, Entry, 0, REG_DWORD, Value, 4) 'write the value
If Not rtn = ERROR_SUCCESS Then 'if there was an error writting the value
If DisplayErrorMsg = True Then 'if the user want errors displayed
MsgBox ErrorMsg(rtn) 'display the error
End If
End If
rtn = RegCloseKey(hKey) 'close the key
Else 'if there was an error opening the key
If DisplayErrorMsg = True Then 'if the user want errors displayed
MsgBox ErrorMsg(rtn) 'display the error
End If
End If
End If

End Function
Function GetDWORDValue(SubKey As String, Entry As String)

Call ParseKey(SubKey, MainKeyHandle)

If MainKeyHandle Then
rtn = RegOpenKeyEx(MainKeyHandle, SubKey, 0, KEY_READ, hKey) 'open the key
If rtn = ERROR_SUCCESS Then 'if the key could be opened then
rtn = RegQueryValueExA(hKey, Entry, 0, REG_DWORD, lBuffer, 4) 'get the value from the registry
If rtn = ERROR_SUCCESS Then 'if the value could be retreived then
rtn = RegCloseKey(hKey) 'close the key
GetDWORDValue = lBuffer 'return the value
Else 'otherwise, if the value couldnt be retreived
GetDWORDValue = "Error" 'return Error to the user
If DisplayErrorMsg = True Then 'if the user wants errors displayed
MsgBox ErrorMsg(rtn) 'tell the user what was wrong
End If
End If
Else 'otherwise, if the key couldnt be opened
GetDWORDValue = "Error" 'return Error to the user
If DisplayErrorMsg = True Then 'if the user wants errors displayed
MsgBox ErrorMsg(rtn) 'tell the user what was wrong
End If
End If
End If

End Function
Function SetBinaryValue(SubKey As String, Entry As String, Value As String)

Code: [Select]
Call ParseKey(SubKey, MainKeyHandle)

If MainKeyHandle Then
rtn = RegOpenKeyEx(MainKeyHandle, SubKey, 0, KEY_WRITE, hKey) 'open the key
If rtn = ERROR_SUCCESS Then 'if the key was open successfully then
lDataSize = Len(Value)
ReDim ByteArray(lDataSize)
For i = 1 To lDataSize
ByteArray(i) = Asc(Mid$(Value, i, 1))
Next
rtn = RegSetValueExB(hKey, Entry, 0, REG_BINARY, ByteArray(1), lDataSize) 'write the value
If Not rtn = ERROR_SUCCESS Then 'if the was an error writting the value
If DisplayErrorMsg = True Then 'if the user want errors displayed
MsgBox ErrorMsg(rtn) 'display the error
End If
End If
rtn = RegCloseKey(hKey) 'close the key
Else 'if there was an error opening the key
If DisplayErrorMsg = True Then 'if the user wants errors displayed
MsgBox ErrorMsg(rtn) 'display the error
End If
End If
End If

End Function


Function GetBinaryValue(SubKey As String, Entry As String)

Call ParseKey(SubKey, MainKeyHandle)

If MainKeyHandle Then
rtn = RegOpenKeyEx(MainKeyHandle, SubKey, 0, KEY_READ, hKey) 'open the key
If rtn = ERROR_SUCCESS Then 'if the key could be opened
lBufferSize = 1
rtn = RegQueryValueEx(hKey, Entry, 0, REG_BINARY, 0, lBufferSize) 'get the value from the registry
sBuffer = Space(lBufferSize)
rtn = RegQueryValueEx(hKey, Entry, 0, REG_BINARY, sBuffer, lBufferSize) 'get the value from the registry
If rtn = ERROR_SUCCESS Then 'if the value could be retreived then
rtn = RegCloseKey(hKey) 'close the key
GetBinaryValue = sBuffer 'return the value to the user
Else 'otherwise, if the value couldnt be retreived
GetBinaryValue = "Error" 'return Error to the user
If DisplayErrorMsg = True Then 'if the user wants to errors displayed
MsgBox ErrorMsg(rtn) 'display the error to the user
End If
End If
Else 'otherwise, if the key couldnt be opened
GetBinaryValue = "Error" 'return Error to the user
If DisplayErrorMsg = True Then 'if the user wants to errors displayed
MsgBox ErrorMsg(rtn) 'display the error to the user
End If
End If
End If

End Function
Function DeleteKey(Keyname As String)

Call ParseKey(Keyname, MainKeyHandle)

If MainKeyHandle Then
rtn = RegOpenKeyEx(MainKeyHandle, Keyname, 0, KEY_WRITE, hKey) 'open the key
If rtn = ERROR_SUCCESS Then 'if the key could be opened then
rtn = RegDeleteKey(hKey, Keyname) 'delete the key
rtn = RegCloseKey(hKey) 'close the key
End If
End If

End Function

Code: [Select]
Function GetMainKeyHandle(MainKeyName As String) As Long

Const HKEY_CLASSES_ROOT = &H80000000
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
Const HKEY_USERS = &H80000003
Const HKEY_PERFORMANCE_DATA = &H80000004
Const HKEY_CURRENT_CONFIG = &H80000005
Const HKEY_DYN_DATA = &H80000006

Select Case MainKeyName
Case "HKEY_CLASSES_ROOT"
GetMainKeyHandle = HKEY_CLASSES_ROOT
Case "HKEY_CURRENT_USER"
GetMainKeyHandle = HKEY_CURRENT_USER
Case "HKEY_LOCAL_MACHINE"
GetMainKeyHandle = HKEY_LOCAL_MACHINE
Case "HKEY_USERS"
GetMainKeyHandle = HKEY_USERS
Case "HKEY_PERFORMANCE_DATA"
GetMainKeyHandle = HKEY_PERFORMANCE_DATA
Case "HKEY_CURRENT_CONFIG"
GetMainKeyHandle = HKEY_CURRENT_CONFIG
Case "HKEY_DYN_DATA"
GetMainKeyHandle = HKEY_DYN_DATA
End Select

End Function

Function ErrorMsg(lErrorCode As Long) As String

'If an error does accurr, and the user wants error messages displayed, then
'display one of the following error messages

Select Case lErrorCode
Case 1009, 1015
GetErrorMsg = "The Registry Database is corrupt!"
Case 2, 1010
GetErrorMsg = "Bad Key Name"
Case 1011
GetErrorMsg = "Can't Open Key"
Case 4, 1012
GetErrorMsg = "Can't Read Key"
Case 5
GetErrorMsg = "Access to this key is denied"
Case 1013
GetErrorMsg = "Can't Write Key"
Case 8, 14
GetErrorMsg = "Out of memory"
Case 87
GetErrorMsg = "Invalid Parameter"
Case 234
GetErrorMsg = "There is more data than the buffer has been allocated to hold."
Case Else
GetErrorMsg = "Undefined Error Code: " & Str$(lErrorCode)
End Select

End Function

Function GetStringValue(SubKey As String, Entry As String)

Call ParseKey(SubKey, MainKeyHandle)

If MainKeyHandle Then
rtn = RegOpenKeyEx(MainKeyHandle, SubKey, 0, KEY_READ, hKey) 'open the key
If rtn = ERROR_SUCCESS Then 'if the key could be opened then
sBuffer = Space(255) 'make a buffer
lBufferSize = Len(sBuffer)
rtn = RegQueryValueEx(hKey, Entry, 0, REG_SZ, sBuffer, lBufferSize) 'get the value from the registry
If rtn = ERROR_SUCCESS Then 'if the value could be retreived then
rtn = RegCloseKey(hKey) 'close the key
sBuffer = Trim(sBuffer)
GetStringValue = Left(sBuffer, Len(sBuffer) - 1) 'return the value to the user
Else 'otherwise, if the value couldnt be retreived
GetStringValue = "Error" 'return Error to the user
If DisplayErrorMsg = True Then 'if the user wants errors displayed then
MsgBox ErrorMsg(rtn) 'tell the user what was wrong
End If
End If
Else 'otherwise, if the key couldnt be opened
GetStringValue = "Error" 'return Error to the user
If DisplayErrorMsg = True Then 'if the user wants errors displayed then
MsgBox ErrorMsg(rtn) 'tell the user what was wrong
End If
End If
End If

End Function

Private Sub ParseKey(Keyname As String, Keyhandle As Long)

rtn = InStr(Keyname, "\") 'return if "\" is contained in the Keyname

If Left(Keyname, 5) <> "HKEY_" Or Right(Keyname, 1) = "\" Then 'if the is a "\" at the end of the Keyname then
MsgBox "Incorrect Format:" + Chr(10) + Chr(10) + Keyname 'display error to the user
Exit Sub 'exit the procedure
ElseIf rtn = 0 Then 'if the Keyname contains no "\"
Keyhandle = GetMainKeyHandle(Keyname)
Keyname = "" 'leave Keyname blank
Else 'otherwise, Keyname contains "\"
Keyhandle = GetMainKeyHandle(Left(Keyname, rtn - 1)) 'seperate the Keyname
Keyname = Right(Keyname, Len(Keyname) - rtn)
End If

End Sub
Function CreateKey(SubKey As String)

Call ParseKey(SubKey, MainKeyHandle)

If MainKeyHandle Then
rtn = RegCreateKey(MainKeyHandle, SubKey, hKey) 'create the key
If rtn = ERROR_SUCCESS Then 'if the key was created then
rtn = RegCloseKey(hKey) 'close the key
End If
End If

End Function
Function SetStringValue(SubKey As String, Entry As String, Value As String)

Call ParseKey(SubKey, MainKeyHandle)

If MainKeyHandle Then
rtn = RegOpenKeyEx(MainKeyHandle, SubKey, 0, KEY_WRITE, hKey) 'open the key
If rtn = ERROR_SUCCESS Then 'if the key was open successfully then
rtn = RegSetValueEx(hKey, Entry, 0, REG_SZ, ByVal Value, Len(Value)) 'write the value
If Not rtn = ERROR_SUCCESS Then 'if there was an error writting the value
If DisplayErrorMsg = True Then 'if the user wants errors displayed
MsgBox ErrorMsg(rtn) 'display the error
End If
End If
rtn = RegCloseKey(hKey) 'close the key
Else 'if there was an error opening the key
If DisplayErrorMsg = True Then 'if the user wants errors displayed
MsgBox ErrorMsg(rtn) 'display the error
End If
End If
End If

End Function