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.

101.

Solve : I did it! Yay!?

Answer»

It's currently 12:08 at GMT-8 as I type this.

I needed to do a project for my Health class, and I was sick of the same ol' posters and crap. "Game" was on the LIST, and, well, the rest is history.

Long story short: I wrote a C++ command-line menu-driven game revolving around Suicide, the last topic of our unit. In it, the player attempts to talk some guy out of jumping off a TALL building. I worried my parents greatly, because I've never finished a "real" C++ program to date.

How did I write a fully-fledged game (by 1990 standards, anyway) within a week, you ask? I'm almost ashamed to say it, but I nearly completely abandoned the concept of OOP. I wrote purely procedural code. I had a one-variable class out of habit, but actually, a global variable would have been easier for something of this small scale. I also stripped the program of all exceptions and error logic, since I'll be the one at the helm.

The game is actually simple enough for a one-page flow chart. Luckily, debugging is a small chore when all conceivable paths are marked. I'm proud to announce my first real program was a Gold-star program -- it compiled and ran to specifications perfectly the first TIME. (I'm not counting the delays in the couts I added later; I left them out at first intentionally for debugging purposes.)

^^^^I'm not sure whether to be proud or scared. What can I say, other than I'm done ahead of time and did a good job? Oh, maybe I should get to bed. Well done! You also learnt a valuable lesson: OOP is just one style of programming available. Each different situation requires a different style and with experiance you will be able to weigh up the pros and cons of each style. Sometimes it can be disastrous to force a particular style "just because".

For small simple projects, OOP can be more trouble than it's worth. Forcing OOP for them can be fine for learning purposes but when it comes to create a "real" (wasn't sure of the correct word to use) program, then consider the best style.

I'm still looking forward to your escape game! I'd rather not use a "software creator" program to make programs. Not only is it "one step removed"* from actual programming, it's Visual Basic. There's nothing wrong with VB as a language, but it's extremely removed from Assembler, which causes unnecessary overhead.

Besides, anything that uses VB requires the .NET framework. Since we're talking 2006-07, it's probably the Framework 2.0. I'd rather not make other users download a 20-something MB thing just so my 400 KB EXE works. When you write in C/C++/Java/Assembler/alltheothers, no additional stuff is required -- it runs on its own.

*FrontPage is "one step removed" from writing HTML. The code it makes is a MESS, and it usually causes only IE to render properly. Not my idea of fun.Learn how to use apostrophes.You mean DeltaSpider, right? If so, then add periods, commas and capital letters to the list. Quote

When you write in C/C++/Java/Assembler/alltheothers, no additional stuff is required -- it runs on its own.

I thought you needed at least the JRE to run Java programs / applets (~16-20Mb download from SUN).

Quote
*FrontPage is "one step removed" from writing HTML. The code it makes is a mess, and it usually causes only IE to render properly. Not my idea of fun.

100% accurate there. I'll take notepad over it any day. When you use any WYSIWYG system for programming or websites it usually makes it 100x harder to maintain (and understand the code) than if you went away and learned the HTML/Java/C(++)/etc...
*Reads up on Java

Oops! Oh well, the rest of my statement stands.

As for WYSIWYG, Dreamweaver is fairly good at not totally botching up the code it makes. It's still hard to maintain, though. And I'd never use a C++ code generator; the mess of code it makes would be a nightmare.

Side-Note: Do you know about the old compilers that would try to correct programmer's mistakes at compile time, so stupid things like forgetting a ; at the end of a line or missing a ) or two wouldn't cause a program that takes 5 minutes to compile to spit back an error instead of linking.

It was a noble quest, but like most of mankind's projects it went way too far. One infamous example is a compiler that someone typed only one word into: "if". No INCLUDES, no "int main()", nothing. Would you believe that it created a 200-line command-line which successfully compiled and ran? Quote
Side-Note: Do you know about the old compilers that would try to correct programmer's mistakes at compile time, so stupid things like forgetting a ; at the end of a line or missing a ) or two wouldn't cause a program that takes 5 minutes to compile to spit back an error instead of linking.

Now if only you could do that with javac.... Then I wouldn't get pages of console text telling me I missed a couple of ;s. It ticks you off enough to check what you type before sending it to the "compiler". Especially when you have to ssh it to the server first as it's running a different version of Java.Sheesh, a suicide negotiator game?  I think I lose by default.Nah, a monkey could beat it. You see, as long as the Suicide Meter is below 50% after five moves, you win a technical victory. It's really not hard at all, but it does include a lot of the things we covered in the Suicide unit at school, and it's playable and, for about a minute or so, interesting to play. Which is why I received an A+ stamped on the printed source code. (It's kinda hard to write the grade on a file...)

For anyone interested, here's the program and the source code. Note that I didn't comment a single line, which is completely out of character for me, I assure you. The only reason for that is that I didn't ever... EVER... want to return to this program and modify it further.

Only other thing to mention is that the dialog is rather cheesy. But hey, a week deadline is an hour or so of creativity.

*grumble grumble* stupid 128KB attach limit... you'll have to compile the source code with Dev-C++ or a similar C++ compiler. But the compiled game is 130 KB -- 2 over the limit. :-/

[old attachment deleted by admin]You need this:

http://upx.sourceforge.net/

It's so amazing. I got a game, with graphics included in the exe, to 114kb. And the guy on the other end doesn't need to do anything or have anything. He just runs like normal.

Edit: On my compiler it is 68kb, and 16kb after upx.I wonder if I can attach a .7z file...

Sweet! 104 KB!

That's amazing... the uncompressed is 400+ KB... (pre-UPX and 7-zip)

[old attachment deleted by admin]I like that game.
Nice job there.Thank you! Again, I got it down to 16kb so I still win.
102.

Solve : Looking to show off your skills ???

Answer»

Hello,

I Just wanted to let you know if any of you (C#\.net programmer) are looking to show off your skills or get involved in a project you might want to consider clamav. ClamAV is the leading OPENSOURCE Antivirus, and right now they are looking for programmers to help with version 1.0 which would include an on acess scanner and possibly other features.
If you are intersted please post in the following post :
http://forums.clamwin.com/viewtopic.php?t=905

Thanks

Al968Hm interesting.. I would like to see how effective an open-source virus scanner might be.It's fairly good.
I have used the portable version a few times.
An on access scanner is the only THING missing from the full one, IMHO.
If they're considering adding it now, I'll definitely check it out, but not until it is available.
Wish I COULD help them . . .Real-time scanning PLUS anti-malware capabilities are added to ClamWin by >Winpooch<.

Well that's rather useful.
Thanks for that.

103.

Solve : cursor mania?

Answer»

Always wanted to know how cursor mania puts the cursor on your COMPUTER and SHOWS it even if your off the internet i will tell you where they files are. WELL so as people think u can do a search over your drive for .cur files which take ages the other way is follow me!
go into your main drive and click on documents and settings!
then click onto the user that uses cursor mania
NEXT local settings
then tempolary internet files
OK STOP STOP
now right click in empty space and arrange it in the form of types
scroll down and guess what
all the cursor files that u have clicked on cursor mania.
simply all cursor mania does is download .cur files onto your computer from their server



ok one question i wonder if anyone found the server they use so u can like download all their .cur files at once and im sure its somewhere in http://www.funwebproducts.com/CursorChooser.html
but dont seem to work and i want all their CURSORS lolWhat the heck did you just say? :-?lol i just put it in the wrong section GREAT
i did it in the morning and quite SLEEPY saw computer program"ing"
missed out the "ing" so clicked on it lol
so im just asking if there is a way to get all the cursor that cursor mania hasThere are programs to make cursors.....not all are free though.that is off the point carbon dudeoxide
im trying to find where all the cursor files are stored for cursor mania
and im sure its on a site because it doesnt download all the files down onto your computer
i ran a search for all .cur files in my comp Well, for starters, I would strongly advise NOT going to funwebproducts.com.  It's basically adware central.lol pretty much
ok watever cracking the server is just
wasting time

104.

Solve : Learning to program??

Answer»

Hi all
My first foray into the programming section
I've decided I'd like to learn to program, as one of the A levels I am looking at doing includes a bit of programming and I'd prefer to know at least the basics before starting (if I actually do that A level and even if I don't I just think it'd be cool to know how to program)
Can anyone POINT me to some good online tutorials or books to get me started?
Anyone have any tips they'd like to share?
I've heard C is a good language to learn, is this true?  What would be the best language for me to start with?
Never done any programming before so any advice is appreciated
Thanks in advanceOthers will scoff but I recommend you start with a high-level language such as QBasic version 4.5.  With no knowledge of programming C and/or C++ can be confusing to a newcomer.  Also QBasic is an interpreted language which is created in an Integrated Development Environment, in other WORDS you can write your program (some checking will be done as you enter each line) and immediately RUN it to check the results.  With some other languages you must write your program in a text editor then compile it then run it.

QBasic is widely used in colleges in the USA and UK as a starting level for students.

QBasic tutorials are freely available on the WWW as are many forums dedicated to that language.

QBasic is a DOS based language so some features such as direct line printing are not available when running in the Windows XP Command environment but there are workarounds for most.

Good luckyou can learn to program using Python. Its easy and fun, with lots more stuffs.
http://www.developer.com/open/article.php/625901
Cool, thanks a lot for the advice guysThanks Ghostdog74 ... Never knew that Python was FREE, so I never checked into it... Another language to learn... [smiley=thumbsup.gif]Python, Perl, PHP, Ruby, Quanta, etc, etc.  There are loads of free compilers out there.  It is always a good IDEA to choose a programming language that  best suits your intended use.  I rarely stray outside of PHP and javascript, since most of my programming is web-related.  If I were fascinated by A.I. however, I'd probably be sticking to something like Prolog.Visual Basic is good, to create "useful" applications fast. That and a C++ compiler for .NET Express edition can be downloaded for free from Microsoft, suprisingly.Awesome, thanks a lot all of you.
I'll try and make some time soon to learn some of this then.
Thanks.I too would start with VB, just to get the basic CONCEPTS down, then move on to a more complex language.If u wanna program ur own games start with

I started with C++ and I like it ]this site[/url] is the best site to start with

I started with C++ and I like it Obviously not so good with the HTML Apparently not . . .  I strongly recommend C# as a starter language.  Microsoft has a free prgramming interface, Visual Studio Express C#, that you can download from their site.

StevoI too have just started to learn to program using python.  A gr8 site is python.com  You can download the python program from there too.   Check it out!That's a BUMP.

105.

Solve : Compiling an VBScript to EXE?

Answer»

I have the following code and I want to compile it to an .exe instead of the standard .vbs, I know you should be able to do it with Visual Basic (I have Microsoft Visual Basic 2005 Espress Edition) but I don't know how, I tried several CONVERTERS on the web but NON of them really worked good.

I want to compile the following code with a specific icon but without .NET FrameWork (so that other users who will use it don't have to install .NET FrameWork first).:

Code: [Select]MsgBox "Warning!" + vbCrLf + vbCrLf + "Don't change the installation folder during install!" + vbCrLf + vbCrLf + "Close this window to begin the installation.",vbOKOnly + vbExclamation,"Warning!"
I hope somebody can tell me or give me a link about how to do this!

Thanks in ADVANCE,

Greetz RubenYou might try the Microsoft Script Encoder. You can download it free at: Script Encoder

Not sure if it creates a exe file (PROBABLY a vbe file) but it should create enough security for all but the most determined hackers.

Hope this helps. Ok thanks! I'll try that, maybe I can open it in Visual Basic 2005 then? Other solutions are still welcome btw!

106.

Solve : Direct3D device reset failed after multiple attempts?

Answer»

Hi, I have a problem with my computer where games freeze and I have to restart the computer via the button on the case. THOUGH with Command & CONQUER 3 I sometimes get this message when it seems like it is doing the freeze.

Now some maybe thinking "so why are you in this part of the forum?" so...

The only information I can find on this is debugging bits of code for C++ which doesn't tell me anything about what this really means or what causes it. So perhaps you guys who write C can tell me more?It is possible that the game has been written in some form of Visual C++, so when some parameter fails, your system points to the failed parameter.

These problems are usually cause by other problems being hardware or software ( registry etc ).

As far as the code for the game, the code is correct unless there is corruption in the game in which a reinstall should clean up. If a reinstall does not clear up, then it is most likely something else in your system that is CAUSING the game to puke, wether it be mismatched Ram, Registry problems, or just about anything else.

You can also check with the manufacturer of the game to see if anyone else has reported a similar problem. Usually you are not the first to see a problem with a game, and usually they have a FAQ setup or search link that will point out exactly what you are seeing.

Sorry that this doesnt pinpoint your problem, but as for the C++ of the game, the code has been tested before release through a quality control process which tests against most hardware and software configurations to debug problems. So the C++ code should be flawless in REGARDS to game play.If you get this error with other programs it seems unlikely to be a problem with the code in one program. Also, commercial games do not give up their source code so easily, to prevent copying. The source code you are getting is probably machine code or assembler.

But without knowing the EXACT contents of this error message, or the code you are getting, I cannot help futher.

I would suggest reinstalling/updating DirectX and your graphics card drivers.

107.

Solve : capslock detector?

Answer»

hi to all!

need HELP in vbscript/ batch

code pls... a script that pop up when the capslock is off.

thanks in advance!No, that won't work. Not in batch.

You WANT  a PROGRAM that works inside of ANOTHER program to tell you the caps lock is on of off.
Just Google:
Caps lock detector for windows

Here is a nice one:
HTTP://download.cnet.com/8301-20_4-10476906-10084490.html

108.

Solve : Visual Basic Command List?

Answer»

Hi IM Very new to programming And NEED a commands list for Visual Basic Express 2010
IF u have one or know where to find One Please HELP You say you are very new to programming. Visual Basic is very visual. You do things with forms and boxes and lists. You can set the properties of things you seen in your work area. You can WRITE a useful program with little need for knowing the individual commands used in modules.
Have you already gone through few tutorials recommended by Microsoft?

Below is a quick reference for many programming yaks that might help you. Look for the area about VB sand .NET for the information sou want.
Quick Reference CardsThank you so much. I came here looking for some help with the c# programming class I am in. I work for a computer repair company as a receptionist, but they recognized my APTITUDE and let me join their techs' programming class. I am struggling a bit so that really helped. Thanks!Glad to help. Continue with you study of Visual Basic.
There are many tutorials. Helps one for the novice. Links to more.
http://www.youtube.com/watch?v=rew_iMkZ3aw
Have a copy of coffee handy. His VOICE will put you to sleep.This was the newly released programming language and i haven't use it yet but this might help Microsoft VB Programming.

109.

Solve : Question about BASIC (freebasic)?

Answer»

I need to know what the primitive types are for the LANGUAGE BASIC.  I am running freebasic if it makes a difference.   I can't FIND the information online anywhere.  THank you in advance for the HELP.For a long time the types used in  most BASIC compilers has been
Floating point
String
Integer
There was no type for byte, but some commands and functions requited byte values. For EXAMPLE, the function CHR$(n) requires that n be limited to a byte value.
Does that help any?

There is a free basic FORUM. Did you look there?
http://www.freebasic.net/forum/
There you can find that freeBASIC contains more data types.
http://www.freebasic.net/wiki/wikka.php?wakka=CatPgStdDataTypes

110.

Solve : adding a usb drive?

Answer»

Hi Guys:
I am trying to add a usb drive to a Debain system. It Will show on the desktop just fine, I can read and write to it also.
my problem when i want to add it to a program.

/var/drive/subfolder
/drive/subfolder
/home/drive/subfolder
/desktop/drive/subfolder

thanks for your help
William
Are you saying you can open the USB drive by CLICKING an icon on the desktop?  If so, the device is probably mounted somewhere like /mnt/usb - but your mileage may vary.  Have a look in the /mnt directory to SEE what's listed there.  You might also check the /media directory, which deals with automounted media in some distros.Hey Rob:
Yes i can use the drive from the desktop. its the CORRECT sintax to use in a program that I need help with.when
I go to my computer this is I get.

------------------------------------------
william
desktop
file system
network
pavilion (usb drive)
trash
------------------------------
documents
music
pictures
videos
downloads

Quote from: Rob Pomeroy on September 22, 2011, 08:59:33 AM

Have a look in the /mnt directory to see what's listed there.  You might also check the /media directory, which deals with automounted media in some distros.

Use Nautilus or whatever file MANAGER your Debian INSTALL favours; alternatively, use a terminal window:

Code: [Select]ls /mnt
ls /media
111.

Solve : C++ trying to figure out how to clip file extensions for project?

Answer»

I have a project I am working on in C++ using VC++ 6 and I am reading in a text file that is output from a batch that runs a series of dir/b *.extension>>list.txt routines to append to file all file extensions I want to have in my list file instead of just all files in that directory. This is used to list all the movie/VIDEOS to this text file. The C++ is used to create/compile a HTML page for my HTPC.

Currently I am able to open the list.txt file and add each line to the creation of an HTML page that places that lines contents as a hyperlink in an alphabetical listing, but instead of listing it as say movie1.mp4, I want to list it as movie1. So I was thinking that if I trimmed 4 characters off of the line, that would solve it, but for some files with 4 character file extensions instead of 3 character file extensions I would then have to trim 5 characters to include the .mp4 or .mpeg to remove the dot as well.

So I was thinking that maybe I can read in the line, then run a process that looks for the dot "." and it doesnt matter then how short or long a file extension is. Only problem is I have never done this before and so I have stumped myself. Did some searching in google and figured I'd post here since I didnt find anything close to what I am trying to accomplish.

In the end the C++ program writes/compiles a htpc.htm webpage that I have linked to the startup of the htpc, so I can pick movies and music etc from an organized menu. I was editing this htpc.htm page manually and thought that I should really just write a program that will import file names and then link them in a html webpage vs having to go in and add the additional line into my html page each time I add new videos and music etc.Why have the batch file to begin with?Hello BC... well I have the batch to begin with mainly because I am using the dir/b to get directory listing. I could have snuck that into the C++ with a system("dir/b *.mp4>>list.txt"); type call but been staying away from using system calls as for I read that they are a bad habit to use in C++. So I figured, I'd run a quick batch, then have my list.txt file ready for me with the files I want to have included in the created HTPC webpage and then use the C++ to then read in this text file and run with it.

*If you can show me a technique to output a file list to a file avoiding the system call in C++, I would be very interested in seeing how this is done. I am sure it can probably be done, but this is new territory accessing a file system to then pass that information (filename.extension) listing to a file vs using DOS commands.

 I have posted a very basic draft of what I have. This isnt the web page I am currently using, just a quick proof of concept sort of test, which generates the HTPC.htm page. HTML is easy to make pretty later on with frames and tables etc later on. I also need to add code to delete the HTPC.htm file if it exists prior to writing to it -or- clear the file first to avoid a double appending of HTML code added to the end of the initial. Deleting it I would have to use a system call, but I might be able to wipe its contents using C++ that I will have to figure out how to pass nothing to it to overwrite something with nothing..lol  then be able to write cleanly to it. I am guessing that i can write overtop of it with a single space " " probably since if it appends the after a single space, the webpage will still act the same as the browser translates it.

Being able to trim off .mp4 and .mpeg from the name of the file listed in the html hyperlink displayed text would be neat to do to clean this up I figured since I just want titles listed and the file entension showing is kind of ugly. I figured there must be a way to find "." and trim "." and the next remaining characters no matter how many there are on that line without affecting the next line below it. But still stumped


Here is test contents of link.txt
Code: [Select]file1.mp4
file2.mp4
file3.mp4
file4.mp4
file5.mp4



And here is my current code, which may look a little ugly without comments and I merged a book reference and online reference of code for technique and then tweaked them together to get what I needed since I am not good at just coding at this level without looking in my books or online etc unless I want to battle it out when compiling and fixing the issues.

Code: [Select]#include<iostream>

using std::cerr;
using std::cout;
using std::endl;

#include<fstream>
using namespace std;
using std::ifstream;

#include<cstdlib>


int main()
{
ifstream indata;
char buffer1[2048];
indata.open("link.txt");
if(!indata){
cerr<<"Error: file could not be opened"<<endl;
exit(1);
}
indata>>buffer1;

ofstream myfile1;
myfile1.open ("htpc.htm",ios::out|ios::app);

myfile1<<"<html>"<<endl;
myfile1<<"<body>"<<endl;
myfile1<<"<center>"<<endl;
myfile1.close();
while(!indata.eof()){
ofstream myfile2;
myfile2.open ("htpc.htm",ios::out|ios::app);

myfile2<<"<a href\""<<buffer1<<"\">"<<buffer1<<"</a><BR>"<<endl;

indata>>buffer1;
myfile2.close();
}
ofstream myfile3;
myfile3.open ("htpc.htm",ios::out|ios::app);
myfile3<<"</body>"<<endl;
myfile3<<"</html>"<<endl;

myfile3.close();




indata.close();
cout<<"End-of-file reached.."<<endl;
return(0);
} Code: [Select]#include <windows.h>
#include <iostream>
#include <fstream>
#include <string>
using namespace std;
//TASK: enumerates all MP3 files in a given directory and creates a simple HTML file with links for each one.
int _tmain(int argc, _TCHAR* argv[])
{
WIN32_FIND_DATA* fdata = (WIN32_FIND_DATA*)malloc(sizeof(WIN32_FIND_DATA));

//Change this as needed to use a different folder.
//change this to change the folder. Possibly make command line argument, who knows.
//make sure to change the HREF line below if you change this, too.
HANDLE fhandle = FindFirstFile(L"D:\\music\\*.mp3",fdata);
BOOL filesfound=TRUE;
if(fhandle==INVALID_HANDLE_VALUE)
{
cout << GetLastError();
filesfound=FALSE;

}
ofstream htmlout;
//delete the file if it exists....
DeleteFile(L"D:\\htpc.htm");
htmlout.open ("D:\\htpc.htm",ios::out|ios::app);
htmlout<< "<html><body><center>";
if(!filesfound) htmlout << "<h2>No Files.</h2>";
if(fhandle!=INVALID_HANDLE_VALUE)
{
for(;;)
{
//assumes fdata->cFileName is a WCHAR_T.
char buff[MAX_PATH];
//wcstombs ( char * mbstr, const wchar_t * wcstr, size_t max );
ZeroMemory(buff,MAX_PATH);
wcstombs(buff,fdata->cFileName,MAX_PATH);
string outputname;
outputname.assign(buff);
cout << "found file:" ;
cout << buff << endl;

int dotpos = outputname.rfind(".");
string titlename = outputname.substr(0,dotpos);

cout << "name:" << titlename;
htmlout << "<a href=\"" << "D:\\music\\" << outputname << "\">" << titlename << " </a><br>\n";
ZeroMemory(fdata,sizeof(WIN32_FIND_DATA));
BOOL fnf=FindNextFile(fhandle,fdata);
if(fnf==0) break;
}
}
htmlout << "</center></body></html>";
FindClose(fhandle);
htmlout.close();
//int test;
//cin>>test;

free(fdata);
return 0;
}


Dave, why don't you just make the original batch file strip off the extensions? And build the html page too? Isn't writing a C++ program to do this using a sledgehammer to crack a nut?Thanks BC for posting the code, I am going to copy/paste and compile and look through it to learn how it works. And may post questions later. Really interested in how it addresses the file system to retreive the info that the dir/b does in that batch.

Hello Salmon.... well the situation I have is that I know some of both batch and C++ with C++ being my stronger skill when dealing with reading/writing from and to files and dealing with variables and strings and am a master of neither, so I end up making lots of ugly mixed program/scripts to get the job done usually.

I guess I went the route of C++ also because I know that batch has limitations and C++ can do all. I mainly didnt know how to perform a process similar to dir/b to access a file system to retrieve file names and figured the batch was the quick band aid to create the information that I can then feed to the C++ program.

*If you have a moment to show how this can be done in batch that would be great. As for I am interested in learning how it can be done by example. It would be neat to see how to pass the contents of dir/b into variables or read in the listing from dir/b that was written to list.txt at the start of the batch to then output that to an html file as well as trimming off the file extensions. I am guessing its mainly just creation of the html file initially by a bunch of Quote

echo. <HTML><BODY>>>htpc.htm
  although I am not sure if escape characters would be needed to not confuse the batch with the < and >  tags of the html, and the planting of the information in a looped process that performs line creation until eof of something similar to Quote
echo. <a href"(variable [A] here to pass full filename and extension)">(variable here to pass the full file name without extension) [/url]>>htpc.htm
/a instead of /url above within < > instead of [ ] ... this is being translated in this page

LOL at using a sledgehammer to crack a nut... yah I guess that is a good analogy to what I was doing! I suppose I was using a sledgehammer because it will squash the nut, while I was unsure if batch was going to be like hitting the nut with a butter knife..lol ... Not to bash batches ability to get the job done, but I guess just using an overkill tool to get the job done because I was sure C++ would do it and unsure as to if batch could do it on its own without running into a limitation.  I came up with this but it's useless and doesn't work for some reason.
Code: [Select]REM output HTML file:
setolocal enabledelayedexpansion
SET outhtml=D:\htpc.html
SET searchpath=D:\music\

echo ^<html^>^<body^>^<center^> > %outhtml%

for /f "delims=*" %%P in ('dir /b %searchpath%*.mp3') do
(
echo "%%P"
call :separate %%P
echo ^<A href="!searchpath!%%P"^>%FILE%^</a^> >> %outhtml%

)
echo ^</center^>^</body^>^</html^> >>%outhtml%
goto EOF
:separate
set FILE=%~n1
set EXT=%~x1
exit /b 0
:EOF
You should stick with whatever you feel comfortable with... I prefer batch or other scripting languages (especially Powershell which (I don't personally think) has such a steep learning curve as some people make out) because you can run the thing and see if it works without having to compile it first. A thought: I expect you "normalise" your file names first so they don't look like this "Nightmare.on.Elm.Street.[XVID].REPACK.Superfly.mp4" where I guess you would isolate the extension by counting backwards from the end of the string until you hit a dot. (of course you wouldn't have files like that would you???!!! Because we're talking about fair-use format shifting of stuff we own. Of course.

Anyhow Windows batch has "variable modifiers" (see the FOR help accessible via FOR /? for details) to help you get at file properties. If %%A is a file name then %%~dA is the drive letter (with colon) and %%~pA is the path (folder), %%~nA is the name part and %%~xA is the extension (with dot) so if you did this you would echo just the file names

FOR /F "delims=" %%A in ('dir /b *.mp4') do (
    echo %%~nA
    )

You can echo characters like < and > if you escape them with carets like this ^< so you could make a simple html file like this

FOR /F "delims=" %%A in ('dir /b *.mp4') do (
    echo %%~nA^ >> mymenu.html
    )

Code: [Select]S:\Test\movie list>dir
 Volume in drive S is USB-1
 Volume Serial Number is 2C51-AA7F

 Directory of S:\Test\movie list

09/08/2011  21:16    <DIR>          .
09/08/2011  21:16    <DIR>          ..
06/06/2011  18:56       185,665,722 1307293768080.mp4
07/06/2011  18:36       168,581,204 1307401963926.mp4
14/06/2011  17:41       174,549,670 1308008220765.mp4
22/06/2011  20:40       401,292,105 1308705903296.mp4
09/08/2011  21:16               289 make-html.bat
17/05/2011  00:49       172,288,053 Mapa sonoro Antonia Font 16-05-11.mp4
09/08/2011  21:16             1,036 mymenu.html
07/05/2011  21:08       331,807,998 Spiral_Series_3_-_The_Butcher_of_La_Villette_Episode_10_b010w7m9_default.mp4
03/04/2011  09:55       313,634,325 Spiral_Series_3_-_The_Butcher_of_La_Villette_Episode_1_b01075w0_default.mp4
03/04/2011  10:00       332,694,729 Spiral_Series_3_-_The_Butcher_of_La_Villette_Episode_2_b01083xt_default.mp4
10/04/2011  10:32       321,423,288 Spiral_Series_3_-_The_Butcher_of_La_Villette_Episode_3_b0109bll_default.mp4
10/04/2011  10:41       329,109,128 Spiral_Series_3_-_The_Butcher_of_La_Villette_Episode_4_b0109bln_default.mp4
17/04/2011  15:46       334,111,133 Spiral_Series_3_-_The_Butcher_of_La_Villette_Episode_5_b010j4ms_default.mp4
17/04/2011  15:51       348,788,609 Spiral_Series_3_-_The_Butcher_of_La_Villette_Episode_6_b010j4mv_default.mp4
30/04/2011  21:23       327,717,522 Spiral_Series_3_-_The_Butcher_of_La_Villette_Episode_7_b010p4x2_default.mp4
30/04/2011  21:27       323,716,560 Spiral_Series_3_-_The_Butcher_of_La_Villette_Episode_8_b010p4x4_default.mp4
07/05/2011  21:05       314,839,606 Spiral_Series_3_-_The_Butcher_of_La_Villette_Episode_9_b010w7m7_default.mp4
17/05/2011  00:49       172,288,053 test.mp4
              18 File(s)  4,552,509,030 bytes
               2 Dir(s)  237,718,470,656 bytes free
Code: [Select]echo off
echo ^<html^> > mymenu.html
echo ^<body style="font-family:Arial; font-size:18px;margin-left:50px"^> >> mymenu.html
echo Movie List^</br^> >> mymenu.html
FOR /F "delims=" %%A in ('dir /b *.mp4') do (
    echo %%~nA^</br^> >> mymenu.html
    )
echo ^</html^> >> mymenu.html
   

Code: [Select]S:\Test\movie list>type mymenu.html
<html>
<body style="font-family:Arial; font-size:18px;margin-left:50px">
Movie List</br>
1307293768080</br>
1307401963926</br>
1308008220765</br>
1308705903296</br>
Mapa sonoro Antonia Font 16-05-11</br>
Spiral_Series_3_-_The_Butcher_of_La_Villette_Episode_10_b010w7m9_default</br>
Spiral_Series_3_-_The_Butcher_of_La_Villette_Episode_1_b01075w0_default</br>
Spiral_Series_3_-_The_Butcher_of_La_Villette_Episode_2_b01083xt_default</br>
Spiral_Series_3_-_The_Butcher_of_La_Villette_Episode_3_b0109bll_default</br>
Spiral_Series_3_-_The_Butcher_of_La_Villette_Episode_4_b0109bln_default</br>
Spiral_Series_3_-_The_Butcher_of_La_Villette_Episode_5_b010j4ms_default</br>
Spiral_Series_3_-_The_Butcher_of_La_Villette_Episode_6_b010j4mv_default</br>
Spiral_Series_3_-_The_Butcher_of_La_Villette_Episode_7_b010p4x2_default</br>
Spiral_Series_3_-_The_Butcher_of_La_Villette_Episode_8_b010p4x4_default</br>
Spiral_Series_3_-_The_Butcher_of_La_Villette_Episode_9_b010w7m7_default</br>
test</br>
</html>



Quote from: BC_Programmer on August 09, 2011, 01:52:18 PM
I came up with this but it's useless and doesn't work for some reason.

Code: [Select]'setolocal' is not recognized as an internal or external command,
operable program or batch file.
No comment...

Code: [Select]The syntax of the command is incorrect.
S:\Test\movie list>for /f "delims=*" %P in ('dir /b S:\Test\movie list*.mp4') do
You want the open parenthesis on the same line as the DO

Code: [Select]REM output HTML file:

REM not needed!
setlocal enabledelayedexpansion

SET outhtml=D:\htpc.html

REM I changed this to suit my test folder
SET searchpath=%cd%

echo ^<html^>^<body^>^<center^> > %outhtml%

REM OK now I ut a backslash in
for /f "delims=*" %%P in ('dir /b "%searchpath%\*.mp4"') do (
echo "%%P"

REM Colon is not obligatory
REM You can do this inline anyhow
call separate %%P
echo ^<A href="%searchpath%%%P"^>%FILE%^</a^> >> %outhtml%
)
echo ^</center^>^</body^>^</html^> >>%outhtml%

REM Gotta skip over the sub somehow
goto end


:separate
set FILE=%~n1
set EXT=%~x1

REM This is how you get out of the sub
REM There isn't actually a label CALLED :EOF
REM This MEANS RETURN
REM This colon is obligatory
goto :EOF

:end
REM We're done



Code: [Select]<html><body><center>
<A href="S:\Test\movie list1307293768080.mp4"></a>
<A href="S:\Test\movie list1307401963926.mp4"></a>
<A href="S:\Test\movie list1308008220765.mp4"></a>
<A href="S:\Test\movie list1308705903296.mp4"></a>
<A href="S:\Test\movie listMapa sonoro Antonia Font 16-05-11.mp4"></a>
<A href="S:\Test\movie listSpiral_Series_3_-_The_Butcher_of_La_Villette_Episode_10_b010w7m9_default.mp4"></a>
<A href="S:\Test\movie listSpiral_Series_3_-_The_Butcher_of_La_Villette_Episode_1_b01075w0_default.mp4"></a>
<A href="S:\Test\movie listSpiral_Series_3_-_The_Butcher_of_La_Villette_Episode_2_b01083xt_default.mp4"></a>
<A href="S:\Test\movie listSpiral_Series_3_-_The_Butcher_of_La_Villette_Episode_3_b0109bll_default.mp4"></a>
<A href="S:\Test\movie listSpiral_Series_3_-_The_Butcher_of_La_Villette_Episode_4_b0109bln_default.mp4"></a>
<A href="S:\Test\movie listSpiral_Series_3_-_The_Butcher_of_La_Villette_Episode_5_b010j4ms_default.mp4"></a>
<A href="S:\Test\movie listSpiral_Series_3_-_The_Butcher_of_La_Villette_Episode_6_b010j4mv_default.mp4"></a>
<A href="S:\Test\movie listSpiral_Series_3_-_The_Butcher_of_La_Villette_Episode_7_b010p4x2_default.mp4"></a>
<A href="S:\Test\movie listSpiral_Series_3_-_The_Butcher_of_La_Villette_Episode_8_b010p4x4_default.mp4"></a>
<A href="S:\Test\movie listSpiral_Series_3_-_The_Butcher_of_La_Villette_Episode_9_b010w7m7_default.mp4"></a>
<A href="S:\Test\movie listtest.mp4"></a>
</center></body></html>

but it doesn't work in my browser...






Thanks Salmon for showing me how to do that in batch. I have gone in and changed my file names manually for many of the MP4's since some were created as DVD_unknown.mp4 for example and then I have to go in and type Cheech_And_Chong__Things_Are_Tough_All_ Over.mp4 and switch like Terminator4x3.mp4 to just Terminator.mp4. I am using Format Factory to generate many of my MP4's off of my DVD collection and it worked really well for about 95% of my movies. Other DVD's that don't like it I can use my capture card and software in the HTPC to act like a DVR to play to the HTPC from my DVD player and create the MP4 the long way for my home theater setup. The DVD's and VHS tapes then go into storage and I have my entire movie collection on a 500GB drive which is currently about 200GB. My wife the one day said oh, well since you converted those movies we can now get rid of them and sell them... I SAID NOOOO WAY!!! Its Piracy if we dont retain ownership of the movies! So we legally have to keep physical posession of them for as long as we own the digital copy of it. She agreed then to let the box of movies stay in the closet untampered with..lol   So I am only creating "Fair-Use" Format Shifted COPIES! Most movies are about 700MB to 1.2GB in size created as 720 format. Since I only have a 32" screen 720 is fine.

Since I want to know how to do it in both Batch & C++ now, and have some compile errors in C++, I am going to continue this thread with the errors I got with BC's code to figure out why I am having compile issues. It might be as simple as my compiler is different than BC's.

I ran into a problem years ago when i was writing C++ in both Borland 4.0 that I owned which came bundled with a Borland book, and MS VC++ 5.0 that the college owned at the time in which one liked the header or handler I think its called #include and the other preferred #include...so i tried to remove the .h from #include since the rest were without .h and got a single error of windows not found or something along those lines. Also went and added .h to those without.h to make all the same statement style and it then gave me like 13 errors instead of 4 compiling. So below is the error I get that maybe you can point me in the right direction to resolve since it doesnt look very straight forward to me as a error of missing a ; etc would be.

I have never used the Windows.h header/handler before so maybe I need to do something other than just copy/paste and compile. In the past with other programs calling out to custom .h files, I remember having to go in and build .h files to be present for the compilation when it links it to the main program. I have never written my own .h file to link to and mainly have coded within the console programming C/C++ environment as taught in college. I kind of feel like I was passed through the system when it comes to C++ programming as for in advanced C++ we were only dealing with CLASSES. Leaving college with a Computer Systems Management (MIS) Degree and favoring C++ over other languages and digging into the more advanced stuff, i feel as if they should have covered classes when I took the 2nd course Intermediate C++, then really dove into the advanced stuff in the advanced C++ the 3rd semester to go into stuff like what BC has coded here that is new territory and I am soaking up as much info as I can from it. The other thing I need to do is stay active with it too instead of just coding when I need something, since if you dont use it you lose it. Similar to how I passed advanced math with calculus and loved trig, and when going to assist a friend with his math the one day after not doing it for almost 10 years, I knew some stuff right off, but other stuff I was like hmm...lets look it up..lol If I played with it after learning it, I would have retained it better and programming is the same way I feel.
Quote
--------------------Configuration: htpc3 - Win32 Debug--------------------
Compiling...
htpc3.cpp
c:\dchtml\htpc3.cpp(7) : error C2061: syntax error : identifier '_TCHAR'
c:\dchtml\htpc3.cpp(14) : error C2664: 'FindFirstFileA' : cannot convert parameter 1 from 'unsigned short [15]' to 'const char *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
c:\dchtml\htpc3.cpp(24) : error C2664: 'DeleteFileA' : cannot convert parameter 1 from 'unsigned short [12]' to 'const char *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
c:\dchtml\htpc3.cpp(36) : error C2664: 'wcstombs' : cannot convert parameter 2 from 'char [260]' to 'const unsigned short *'
        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Error executing cl.exe.

htpc3.obj - 4 error(s), 0 warning(s)
Compiles in VC++ 2008.

Your problem (assuming it isn't also related to compiler versions) is that your defs are set to use ANSI rather than Unicode. I think that is the default for earlier versions of the MS compiler. This breaks the assumption that fdata->cFileName is a WCHAR_T, as well as others.

enter #define UNICODE before the windows.h include.

Quote
The other thing I need to do is stay active with it too instead of just coding when I need something, since if you dont use it you lose it.
I hardly ever write C++ code, personally. I know  what you mean but I don't think it applies as strongly as you think. There is certainly no reason to shoehorn projects into a C++ mould.Thanks BC I'll give that a try on my VC++ 6.0... I figured it was compiler version related. Never knew about the ANSI vs Unicode change.

I have been tempted to install a newer version of MS C++ such as 2008 Express which came bundled with my VC++ 2008 Book, but the clunker workhorse laptop I use while on breaks at work is a Pentium III 600Mhz with 384MB Ram running clean unpatched oem install of XP Pro SP2, and patching it to SP3 and all updates for a laptop that remains as offline usage brings it to a horrible crawl, so I figured going through installing 2008 and Dot NET etc might be too much for it to handle. I have VC++ 2008, VB 2008, and C# 2008 installed on my desktop home computer and played with them some. Only complaint I have with them is that whatever you write you need to make sure that Dot NET 3.5 I think the version is is installed on any system that you execute the compiled programs from. Its too bad they cant squeeze that into the .EXE so it can be stand alone I guess you could call it vs requiring the 3.5 framework that most systems I have seen dont normally update to with MS updates. I think the MS updates bring systems to Dot NET 2.0.

Salmon... I tried your batch and tweaked it some to work on my system which is executing it on C: instead of D: and the problem I am seeing same as what your output shows is that the instruction to pass %FILE% into the created HTML line that is written to HTPC.htm seems like its not getting populated with the File Name information.

For some reason, %FILE% in the line below isnt inherriting the file name from set FILE=%~n1 so because of this the page loads as an empty page with no text linked when you load the htpc.htm page.

Code: [Select]echo ^<A href="%searchpath%%%P"^>%FILE%^</a^> >> %outhtml%Here is what is created from the batch when changing SET outhtml=D:\htpc.html to SET outhtml=C:\htpc.html since my D: drive is my DVD drive. I also have to change SET searchpath=%cd% to SET searchpath=%cc% , which was a guess on my part that the "d" meant D: drive and so the last "c" would be C: drive, and that gives me the output of

Code: [Select]<html><body><center>
<A href="test1.mp4"></a>
<A href="test2.mp4"></a>
<A href="test3.mp4"></a>
</center></body></html> 
Instead of

Code: [Select]<html><body><center>
</center></body></html>
so I end up with what you get...so still stuck at %FILE% not POPULATING with the File Name without the extension portion. Once this file name issue is fixed for populating %FILE% we should end up with


Code: [Select]<html><body><center>
<A href="test1.mp4">test1</a>
<A href="test2.mp4">test2</a>
<A href="test3.mp4">test3</a>
</center></body></html>the batch you used  there was the one I originally created, with his modifications. As he noted, it doesn't work. I don't think it is worth fixing since he already offered a batch solution.


Quote from: DaveLembke on August 09, 2011, 06:52:28 PM
Only complaint I have with them is that whatever you write you need to make sure that Dot NET 3.5 I think the version is is installed on any system that you execute the compiled programs from. Its too bad they cant squeeze that into the .EXE so it can be stand alone I guess you could call it vs requiring the 3.5 framework that most systems I have seen dont normally update to with MS updates. I think the MS updates bring systems to Dot NET 2.0.
And yet, nobody seems to consider the necessity of a JVM and the Java class libraries being installed to run java programs as a point against Java development. Almost every Development tool will require something of the host machine in the way of libraries for any non-trivial project. All Versions of Visual Studio .NET allow you to target a different framework version. You can create programs that target .NET 2.0 in Visual Studio 2008. I don't, because there is no point. If somebody doesn't have .NET 3.5 installed, they can install it. I'm not about to do more work getting things working with .NET 2.0 just so somebody can be lazy; additionally, Windows Vista and 7 come with .NET 3.5 anyway, and I don't make a habit of targeting 10 year old Operating Systems.

Also of interest: if you do it right, you can create executables that run on both Windows, OSX, and Linux using .NET. Which is an advantage.


Quote from: DaveLembke on August 09, 2011, 06:52:28 PM
I also have to change SET searchpath=%cd% to SET searchpath=%cc% , which was a guess on my part

%cd% is a special Windows-supplied variable - it holds the drive letter and path of the current directory at the time the code is run. %cc% will presumably just be blank. Anyhow as BC_P said, I was just playing around with his code. You could try the code in my post, the one which starts "You should stick with whatever you feel comfortable with..." but on that note, it may be that going into batch was a step in the wrong direction, and I apologise for hijacking the thread to no good purpose.




Quote from: DaveLembke on August 08, 2011, 08:29:30 PM
So I figured, I'd run a quick batch, then have my list.txt file ready for me with the files I want to have included in the created HTPC webpage and then use the C++ to then read in this text file and run with it.

You could just modify the batch you run first. Instead of this...

dir /b *.mp4 >> list.txt

...you could use this, which does the same thing except it strips off the .mp4 extension:

for /f "delims=" %%A in ('dir /b *.mp4') do echo %%~nA >> list.txt


112.

Solve : Cmd sleep command?

Answer»

Hey,
I thought my problem felt under programming not sure if it rly does.
Here is my story you need to know. Im making a program in note pad.
The POINT of it is to anoy my FRIENDS for fun. My program i have is it sets the date to 05-11-2011 and the time to 13:37 further more it starts cmd multiple times lets say till infinity. This is where my problem starts. I want to be abel to make it STOP. To pause it but i don't know how. I want it to be paused when i press the key "k" without having to press enter.

Here is my code
echo off
Date 05-11-2011
Echo
:elite
Time 13:37
Start C:\WINDOWS\system32\cmd.exe
Goto elite

I hope you would like to help me with this

Best regards,
V05112011When you joined this forum, you declared that you had read the rules and agreed to obey them. So why are you asking for help with a prank, which is not allowed?
Hmm who the .... Reads the terms of rules or shizzle... :/ well ty for letting me know and sorry for bothering you with this ^^ Quote from: V05112011 on AUGUST 22, 2011, 04:11:19 AM

Hmm who the .... Reads the terms of rules or shizzle... :/

You, if you want to stay here.
Quote
:elite
Time 13:37
Start C:\WINDOWS\system32\cmd.exe
Goto elite

i find the function NAME funny; elite... are you serious? go read a book
113.

Solve : .bat runas?

Answer»

Hello all,
 
I am running "regedit" from a computer that is not logged in with administrator priveliges in Windows XP Professional. The computer must stay logged into the profile called "PUser" (it is a power user profile... CREATIVE name, I KNOW)
I am running regedit from a batch file, and this line of code works beautifully:
 
"runas /user:localhost\administrator regedit"
 
the only drawback is that it ALWAYS PROMPTS me for "administrator"s password. I want to include the password somewhere in the command line or something like that so that it automatically logs in. The security of this obvious availability of the password is not a problem.
 
THANKS,
-darrylhttp://blogs.msdn.com/oldnewthing/archive/2004/11/29/271551.aspx

An "answer" to your problem:
http://www.tek-tips.com/viewthread.cfm?qid=1148483&page=1

114.

Solve : Computer Firewall bypass?

Answer»

Im at schooll and me and a few friends of mine are ATTEMPTING to use tel net to bypass our schools FIREWALL we need a port number to an anomity site or h.e u spell it.

PST or give any TIPS you may HAVEYOU'd need a *censored* of a lot of programming EXPERIENCE to hack a server. Nobody here will teach you how to hack, as it would require years of training. Topic closed.

115.

Solve : Compiler Construction: Design A Scanner?

Answer»

Hi guys, Well i don't KNOW whether this is the right place to ask this question with regards to compiler. but i hope someone can HELP or direct me to a site that might help.

Design a SCANNER for the following instruction
A=:B+10*(C-D)

write a program to simulate the ACTION of the above STATE diagram

Thanks

116.

Solve : Input validation?

Answer»

Hi,
I've just started LEARNING PROGRAMMING using python and our tutor told us to always validate our INPUT but I have no idea what that really means or how I would go about doing this.  I am an absolute beginner in programming so a very simple answer would be a gr8 help.
Thx.   [smiley=embarassed.gif] Quote

Hi,
I've just started learning programming using python and our tutor told us to always validate our input but I have no idea what that really means or how I would go about doing this.  I am an absolute beginner in programming so a very simple answer would be a gr8 help.
Thx.   [smiley=embarassed.gif]
input, AFAIK, can mean the input arguments to a function/procedure or the script arguments, or user input. To validate means to check them according to your predefined set of "rules". For example to get the user to key in a number (because you wanted them to) when they run your script, you can use the raw_input() and isdigit() function like this
CODE: [Select]userinput = raw_input("Please ENTER a number: " )
if userinput.isdigit():  # <-- this is considered a validation.
   print "You entered a number, good"
else:
   ...blah...
The above example stores what the user keys in into variable userinput. Then the isdigit() method checks whether its a digit. This is called validation. Its the same for other types of inputs.
Thank you so much Ghostdog74,
That has helped alot.
117.

Solve : C++ questions?

Answer»

i got a few questions on C++
so how do u make a title on the top bit i only know that it should be
  "Windows App",       /* Title Text */ ;

but i dont know where to PUT it....Hi Dilbert,
CAME across your Forum while browsing around…cool stuff u have going on here.
I have a question..
- Seeking experienced programmer with following skills: strong browser UI background, specifically in JavaScript, AJAX, CSS, HTML. ALSO must have good system & software design skills, e.g. OOP. C++/C knowledge a plus.

U know u GET paid if u answer this question, it’s this site called Myndnet…u should check it out..the link is here http://www.myndnet.com/login.jsp?referral=alpa83&channel=A6

It’s this cool place where u get paid for responding to queries…very cool stuff!! http://www.myndnet.com/login.jsp?referral=alpa83&channel=A6
Sign up n lemme know what u think…my mail id is *yoink*

Cheers
Alpa

Uh... do I know you? If so, from where? --Dilbert...i think the admin needs to delete this alpa user....I like the way he singled Dilbert out for no apparant reason.Some people tend to do that.
Quote

Came across [highlight]your Forum[/highlight] while browsing around…cool stuff u have going on here.
?
Odd.
I don't think it's a SPAM bot either, seems like a real user.
Anyway, they'll get spammed . . . alpa, I recommend you remove your email address from your post.Done.weird people across the forum...Nice editing Dilbert, haha.
And lordoftheplat . . . I agree.
118.

Solve : Changing Windows Product Key in VB 2005?

Answer»

I have already managed to WRITE the code to RETRIEVE the key so I can see it, but how can I change the product key, thanks in advanced.  

NOTICE: Some people may see this as ILLEGAL, it is NOT.

119.

Solve : Interesting read?

Answer» http://www.reed.edu/~tuckers/jokes/foot.html

Shooting yourself in the foot with VARIOUS programming languages/interpreted languages. Anyone who's CODED Hello World or better should LOVE this. LOL, NICE find.
120.

Solve : need some programming advise?

Answer»

so i was wondering...
i wanted to learn how to use c++ and javascript
and first of all i just do batch files so these stuff
are nearly completly new to me except for some java
because i use to design webpages wif html so i wonder any1 has
resources for TOTAL noob for c++ and javascriptHi. There are tons of free resources on the web you can get by simply searching in Google.

I've found the follow tutorial helpful. It's a bit condensed, you if you're new to programming you might want to research each part in more depth elsewhere, but it definately contains all the information you need.

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

Javascript has a similar syntax to C++ so it would be silly to learn the two independantly. I would pick one as your main language (Javascript if you're a web PERSON, or C++ if you want to make actual Windows programs etc) then after some experiance in it, learn the second language quickly by simply learning the differences. Eg in Javascript variables are created with the var keyword and can change type, whereas in C++ variables are of a single-unchanging type. (Both methods have their pros/cons).

Even if you want to learn Javascript more I'd suggest learning some C\C++ first partly because it has a better debugger and development tools to get you started. It depends how much programming you've done before.

You can get a free C++ COMPILER here:

http://msdn.microsoft.com/vstudio/express/visualc/

I would suggest you use Firefox to test your Javascript, as in the tools menu you have a very handy error/Javascript console. Clear it to remove the junk from other websites then run your program and it will inform you of any errors. But if you will be "unleashing" your creations upon the world, make sure to test they are compatable with Internet EXPLORER... sometimes you need to script parts two ways for each browser.

Good luck and if you need any more information just ask.thanks and i will stick to C/C++ first because there is a easier way to make web...
FRONTPAGE a million times easier copy and paste here and there and itz done
and thx for the resouceoh my god im aready stuck wif C++
OK so on the web it gave like codes and
well yeah i copied it and copiled it and the code is:
// stringstreams
#include
#include
#include
using namespace std;

int main ()
{
  string mystr;
  float price=0;
  int quantity=0;

  cout << "Enter price: ";
  getline (cin,mystr);
  stringstream(mystr) >> price;
  cout << "Enter quantity: ";
  getline (cin,mystr);
  stringstream(mystr) >> quantity;
  cout << "Total price: " << price*quantity << endl;
  RETURN 0;
}



ok so i launch the file
and it as for the price still working fine
then asks for the quantity AND STOP ok right wen i enter the quantity and
press enter it closes the ms-dos immidietly it doesnt let me look at the
so called "result"Please try to phrase your questions in English...

I think what you mean is the program runs and closes before you can see the result. Try putting getchar(); on the line above return 0;ah... kewl so u have to put a different command before it so it wont closee...

121.

Solve : .bat file bombing out - trying to move files acros?

Answer»

This batch job (below) sits on a server that calls a server in a REMOTE location.  The remote server then calls a server in a different remote location.  I am trying to move images using a single batch file.  All of the servers have permissions on each other.  

My job bombs out on the:
 for %%f in (%STORENEW%) do CALL :PULLIMAGES %%f%

any help is greatly appreciated
thanks, Jlav


REM * VARIABLES
SET STORENEW=\\store0%\abolder\bfolder\cfolder\*.jpeg
SET HQPULLED=\\hqserver\e\data\
SET STOREPULLED=\\store0%\Pulled\
SET ERRORLOG=pullImages.err

REM **********************************************
REM * CHECK FOR STORE NUMBER PASSED AS PARAM TO BATCH JOB.
REM **********************************************
if "%1"=="" GOTO NOSTOREERROR

REM **********************************************
REM * FOR EACH FILE IN NEW DIRECTORY AT STORE, PULL.
REM **********************************************
ECHO %%f
for %%f in (%STORENEW%) do CALL :PULLIMAGES %%f%
GOTO END

REM **********************************************
REM * PULLIMAGES - Copy images to HQ, move to pulled
REM * dir at store.  
REM **********************************************
:PULLIMAGES
ECHO PULLING %1 TO HQ
COPY %1 %HQPULLED%
IF "%ERRORLEVEL%"=="1" GOTO PULLINGERROR
ECHO MOVING TO PULLED DIR AT STORE
MOVE %1 %STOREPULLED%
IF "%ERRORLEVEL%"=="0" GOTO MOVINGERROR

GOTO END

REM **********************************************
REM * NOSTOREERROR - Error if no stores is passed to batch job.
REM **********************************************
:NOSTOREERROR
ECHO PLEASE PASS A STORE NUMBER TO PULL NOF IMAGES FROM. >> %ERRORLOG%
EXIT /B

REM **********************************************
REM * PULLINGERROR - Error if pulling file to HQ.
REM **********************************************
:PULLINGERROR
ECHO ERROR PULLING FILE %1 TO %HQPULLED%.  FILE SKIPPED. >> %ERRORLOG%
EXIT /B

REM **********************************************
REM * MOVINGERROR - Error if moving file from new to pulled dir at store.  
REM **********************************************
:MOVINGERROR
ECHO ERROR MOVING FILE %1 TO %STOREPULLED% DIR AT STORE. >> %ERRORLOG%  
EXIT /B

:ENDRemove the : in "CALL :PULLIMAGES", and REPLACE CALL with GOTODilbert, thank you for your response.  I FOLLOWED your ADVISE and changed that line of code to

for %%f in (%STORENEW%) do GOTO PULLIMAGES %%f%

but it is still not copying or moving the files.  Am I missing something else?  Again, thanks for your help.  This is my first forray into batch files.  jlav
Remove the %%f% from the same line.

122.

Solve : Automated copying and scheduling over LAN?

Answer»

Hey All,

I don't really know much about VBscript, but I am trying to make a little script, and it is definitely out of my range of expertise...

I have a local area network, and I have made a little Batch program to run a specific video FILE for a certain period each night. I want to make it all scheduled via Windows Scheduling, but I'd really rather not take the TIME to VNC to each computer and set everything up manually, so this is what I'm trying to aim for:

One script (or something) that will run from the host computer, and copy files from the shared folder to a dir on root (C:\) for each computer on the network (I think 14 PCs). Once it has copied the files/folder, I would want it to automatically delete any scheduled tasks, and create a new task that addresses EXAMPLE.exe to run on specified night from X to Y times.

Anyway... I'm not really sure how ELSE to explain what I'm trying to do... but yeah. It doesn't necessarily need to be using VBScript either... I am willing to apply basically anything I think.

Also, all of the computer on the LAN are running Win XP Pro (I believe SP2, but possibly SP1).

Thanks in advance,
kyle_engineerFirst of all, I am not capable of helping you. But here are some observations.

Why must you put it on the C:\ of any PC? This is not a good practice. All of the PCs should have a folder call "Shared Docs" or something like that.
It is also named as:
C:\Documents and Settings\All Users\Documents
That folder can be set to allow full red and write for the administrators.
Also, the administrator can put tasks on a remote machine manually. But it can be set to repeat on every Monday at 8AM or whatever. Here is a screen shot of a PC in the work group

That is all I know.The reason that I want a copy on each computer is primarily because of the fact that 14 computers streaming the same media from a server for 8 - 10 hours might be very difficult for these older computer, that's one of my thoughts. Also, I personally like the idea of localizing all of the operations.

However, I do get what you're saying, and if it proves to be too difficult to be worth it, I'm sure I'll end up going your way.

Anyway, thanks Geek-9pm. You have lots of options. Each PC could be o n a sked to load the file, not all at the ametime.
Perhaps a few min apart, and then all start playing at a given time. The filename on the server would always be the same, just the content would change each day. If the content is null, no show today.

The VLC program is often used for streaming on LAN. Apparently it works for otters. MAYBE it will work for you. It can be either a client or a server. Very nice little program. And it is mostly free.
http://www.engadget.com/2005/11/29/how-to-stream-almost-anything-using-vlc/
Or just Google VLC and find lots of posts. Quote

One script (or something) that will run from the host computer, and copy files from the shared folder to a dir on root (C:\) for each computer on the network (I think 14 PCs). Once it has copied the files/folder, I would want it to automatically delete any scheduled tasks, and create a new task that addresses EXAMPLE.exe to run on specified night from X to Y times.

I think the easier way would actually be to do it backwards. Make a share on the host computer which contains the video file. Then map a network DRIVE on each of the clients. Make a script that simply copies the file from the network drive (ex: drive Z:) to drive C: and plays it. Put that script on the network drive and add it as a scheduled task on each of the comps.


And look here if you need help with with the scheduled tasks command: http://www.robvanderwoude.com/schtasks.phpLinux711, thank for the link. Looks interesting.For automated copying/mirroring, I use Unison.  Might help out with your needs?

http://www.cis.upenn.edu/~bcpierce/unison/

Works cross platform - I use it to keep a directory on one of my Linux servers at home synchronised with a directory on a PC at work.
123.

Solve : To get RAM and CD-ROM serial number?

Answer» ANYONE knows how to get SERIAL number for RAM and CD-ROM using vb.net?

THANK you very much.
124.

Solve : How to monitor COM1 port?

Answer»

I need to know what does a PROGRAM when i launch it regarding to COM1 port.
Can i monitor somehow? I have tried WinSight32 without results.

More details what i need this for, to the FOLLOWING link
http://www.petri.co.il/forums/showthread.php?p=60224#post60224

125.

Solve : hi.?

Answer»

how can i make a program USING LINKE LIST with the implementation of hashing?What programming language might we TALKING about here?

126.

Solve : how can i hack into someone computer using there i?

Answer»

i have someone IP adress and i would LIKE to know how can i HACK into there COMPUTER to see what there doingI suggest hackerhope.com.

127.

Solve : Re: DB Structure for Travel web site?

Answer»

Sounds like you have a candidate for splitting the data into multiple, RELATED TABLES.  What sort of database are you using?  (i.e. MS Access, SQL, ETC.)  Incidentally, re speed - correct table design/separation within a relational database environment, coupled with good SQL query design, will undoubtedly speed up your searches.  Think in terms of fractions of a SECOND for a completed query.I'm afraid I have no experience with Sybase or JSP.  I ould do the database design, but I would need a FULL spec, and that kind of work doesn't come free, not even from nice people like me!  Sorry...   :-/Wow, don't you just love it when the ORIGINAL posters question goes missing.

128.

Solve : Batch files help please!?

Answer»

hi, i was wondering if when CREATING a batch file i could give it a COMMAND to open internet explorer, but to open IE with a site, such as google.
 
can it be done?
 
thank in advance if you do helpcreate a batch file an place this

echo off

cd c:\program files\internet explorer\
iexplore.exe www.google.comYou can also do this...

CODE: [Select]explorer.exe http://www.google.com

129.

Solve : 'else' does not execute?

Answer»
I've written this little program that lets you input a number and the output declares whether it is positive or negative, but want it so that if you enter characters it displays an error. I'm trying to do that with the LAST 'else' statement, but it doesn't work. Can anyone point me in the right direction?

Code: [Select]IMPORT java.util.Scanner;
public class Positive {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
       
        int num;
       
        System.out.println("Enter number");
        num = input.nextInt();
       
        if (num < 0) {
            System.out.println("This is a negative number");
        }
           
        else if (num == 0) {
            System.out.println("Zero");
        }
           
        else if (num > 0) {
            System.out.println("This is a postive number");
        }
       
        else {
            System.out.println("Please enter a valid number");
Thanks in advanceYou seem to be missing a curly bracket.
Or else leave out the curly brackets completely, which only works if you've got a one-line statement. I'm assuming this works in Java - like you I've only started learning it myself. It does work in PHP though.

EDIT: after searching it appears you need to add a try/catch statement to catch the error.

catching the exception is one WAY:

Code: [Select]import java.util.InputMismatchException;
import java.util.Scanner;
public class positive {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
       
        int num;
       
        System.out.println("Enter number");
        try {
        num = input.nextInt();
       
        if (num < 0) {
            System.out.println("This is a negative number");
        }
           
        else if (num == 0) {
            System.out.println("Zero");
        }
           
        else if (num > 0) {
            System.out.println("This is a positive number");
        }
       
        }
        catch(InputMismatchException ime)
        {
        System.out.println("Error: Invalid number");
       
        }
       
    }
       
}

But it's not really the "best" way... best of course being subjective. Generally, if you can do something without raising and catching exceptions, you should. in this case, it's the hasNextInt() function.


Code: [Select]import java.util.InputMismatchException;
import java.util.Scanner;
public class positive {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
       
        int num;
       
        System.out.println("Enter number");
        if(input.hasNextInt())
       {
        num = input.nextInt();
       
        if (num < 0) {
            System.out.println("This is a negative number");
        }
           
        else if (num == 0) {
            System.out.println("Zero");
        }
           
        else if (num > 0) {
            System.out.println("This is a positive number");
        }
       
        }
        else{
        System.out.println("Invalid number");
        }
    }
       
}




and here's my pointlessly reduced version.

Code: [Select]import java.util.Scanner;
public class positive {
public static int Sign(int argument)
{

return argument<0?-1:argument==0?0:1;

}
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
       
        int num;
        String[] resultmessages = new String[]
{"This is a negative number", "Zero","This is a positive number"};
        System.out.println("Enter number");
        if(input.hasNextInt())
        {
        num = input.nextInt();
       
        System.out.println(resultmessages[Sign(num)+1]);
       
       
        }
        else
           System.out.println("Error: Invalid number");
       
       
    }
       
}



Quote from: Salmon Trout on October 02, 2011, 06:18:23 AM
You seem to be missing a curly bracket.

Yes, i didn't copy the end main and end class brackets

BC, i like your second option because it pretty close to what mine is, except it does work.
Quote from: reddevilggg on October 02, 2011, 02:18:07 PM
BC, i like your second option because it pretty close to what mine is, except it does work.

eejit i am, it supposed to read, does NOT work. The second option does NOT work. It works fine for me. If you are copy-pasting into yours to try it, rename the file to positive.java or change the name of the class from positive to Positive. (the latter is a lot easier on windows).
Quote from: BC_Programmer on October 03, 2011, 10:16:59 AM
change the name of the class from positive to Positive.


Of course, i missed that. Works perfect, thanks again.
130.

Solve : House Escape -- an old-style Adventure Game?

Answer»

Hello,

one of my big projects while trying to learn C++ is to create a command-line driven game. It didn't have to be huge; it just had to encompass a good deal of what I know about C++ as an OOP language. This project is nearing completion, and when it does, since I feel I must share something of the scale it's become, I'll release it for play. It probably won't get much attention, but I really don't care.

The main reason I'm going to do this is to get advice on how to improve. I know that online tutorials and instruction books are no match for formal training and, of course, experience. I can't do the first until college, but the second I can get now.

So, the first order of business is to head off this kind of comment: "Why did you use ABC to accomplish this? XYZ would be much more efficient."

Chances are, I haven't seen it before. So if there's an easier way to do something, let me know, but don't ask why I didn't use the most efficient method. My blanket answer is that "I didn't know you could do that..."

*ahem* That aside, next thing is to say what the program basically is and how far I am in completion. The basic premise is that the player is in my house, and for reasons that are disclosed in-game, has to escape it. The geography of my house perfectly matches the one in the game, but in order to make the game challenging, I've had to delve into complete and utter fantasy to keep this from being a 5-move game. It's just one abnormal... entity... of sorts, but it dramatically alters the game. (In retrospect, I wish it was that easy now... this is getting big...)

The game is command-line driven because I don't know how to GUI program yet, and because I can't think of a use for a GUI in this game.

As for writing the game, I am about 80% complete. The commands, their consequences and how they interlink is set up. The big portion of the remainder is writing the command parser. There are only 11 items, but writing every way the player interacts with them and the environment is a pain in the *censored*.

Another hurdle is writing a TUTORIAL. I'm not about to allow my command parser to grow to the point that I have 10 different commands that boil down to the same thing, so I'm having specific commands -- and ONLY these specific commands -- work. To compensate, I'm going to write a tutorial that should make it easy to know how to do something in this game.

In summary: I'm writing a game, it's not done, watch this thread so you can play(test for bugs) and give me coding advice when it is done.

Est. Completion time: 1 week
Accuracy of completion time estimate: Microsoft
Size of project: 48 KB (source code)I HOPE all goes well, as I look forward to seeing this. By the way, are you teaching your self C++, or are you taking a class?

8-)fffreakI plan on going to a class in college, but for now all I've got is a C++ for beginners book and whatever I can find on the Internet (which is a lot!).

Hopefully, the source code will not look like I'm such a beginner (I plan to release it). As it is, the project is getting big.

I'm writing the parser right now, which is adding several hundred lines to the code. I'm up to 1656 in escape.cpp and 371 in escape.hpp. The parser isn't even half done. And I still haven't written int main() yet. THOUGH quite frankly, that won't have much purpose other than to get the player started.

More fun facts:
Classes: 12
Functions: 119


UPDATE 7:00 PM GMT-8: The parser is done, using 592 lines of code to parse 72 commands, not counting the fact that I have several different ways programmed to do the same command (I shouldn't, for example, penalize someone for trying "turn on light" rather than "turn light on").

UPDATE 7:52 PM: int main() has been written. The length of escape.cpp is now 2110 lines, with more to come as I add more functions, fix problems I know exist, and do a final code check before I let the compiler spew errors at me. (Come on, how can a project this big not have code errors?)

Items left on to-do list: 11
Expected time to do next item: 2 hours
Sanity: 0%
Quote

with more to come as I add more functions, fix problems I know exist, and do a final code check before I let the compiler spew errors at me.

Waiting until the end for a compile can be overwhelming and very disheartening. If you write your program modularly, I suggest you compile after each function is complete and fix the errors as you go. One advantage is you can concentrate on the logic more and not the syntax so much.

Just a thought.  8-)

Trouble is, the only code I'm actually concerned about is the code that links up with other classes and their member functions. I'd have to make a mock class system just like the one I'm making, and that would be equally time-consuming.

In a normal program I couldn't agree more. But a game, the way I have it, won't work with that very well. I wish it did. Oh well, good to know for next time. OK the impression I get is that you're writing code but have yet to test if it works? Please tell me that is not true...

Also that seems like a very large amount of functions. I don't want to rain on your parade (I've never used that phrase before) but I have a feeling your code is too specific and not very modular Ask yourself this question: after completion, how easy would it be to add a new possible command, or a new room? If it would take hours of function writing and modification..... well at least you have learnt for next time

I look forward to seeing your code!It is true, I'm afraid.

As for adding new commands, or a new room, that would be easy enough. In fact, that's next on the agenda; a couple of new commands that hopefully add a little to the game.

However, adding a new room is just a tad more time-consuming. Erring on the side of allotting too much time per task, setting up the class in the header with all the needed function prototypes would take about 15-30 minutes, depending on the number of objects. Implementing the room would take about 5 minutes per function. Getting other rooms to "hook up" to the room would take about 30 seconds per room that needs connection (copy-paste, change the target room).

Assuming an average of two objects in a room, and one way to implement each, CREATING a new room should take, at most, an hour.

Addressing the large number of functions: It's not as much as it seems. I can break it down:

The first obstacle is leaving my room. The player needs to collect two items, after doing one thing, and use them, in order to leave it. There's also a function designated to an action that seems reasonable, but won't, in this game, work. That's two items to put in inventory (one func each), one func for the first action needed, one for the action that doesn't work, and two each to implement the items. That's 6 functions right there. Then, there's the one to leave my room, making 7. Finally, there's a "description" function for a "look around" command, private variable accessors, and the constructor and destructor. That makes 14 in the first room.

However, not all the rooms are this intensive. The Guest Bathroom, for example, has only 7, including constructor, destructor, and all item or room-related functions. I think that one's got the fewest functions.

Actually, I think [game detail hidden] is the room with the fewest functions; it's actually got 12 total, but 4 or 5 are, like any command-line game, red herrings.

On average, I have about 9 functions per room, including every way to use an item, the constructors, etc.. However, I've got 11 rooms going, here. That makes appx. 99 functions, and let's not forget the parser which is the backbone of the whole thing. In the interest of making the code easier to read, it's one parser/room. No big deal, it just takes more space that way. (And also solves the problem of a command doing one thing in one room, and a totally different one in another room.)

Sorry to rant, I got carried away. Anyway, I'm getting to it again. Oh dear.... I hate to break it to you, but your design sucks You have basically hard-coded all your rooms and actions and now you FACE the consquences. Never mind a function for each item, you should have one function for all items....I'm not quite following you, here. :-?I'll wait til I see your code, then see what I can suggest Sounds good. I am looking for help, here, so as soon as it's done I'll take all the help I can get. It probably does suck, though. Oookay, I knew that my code sucked, but this is ridiculous. I got a thousand errors, and I'm rewriting.

EDIT: Before I go on, I should ask: If I have a member function of class X, how can I access the member variables of class Y? That seems to be a place it was hanging up the compiler.Neil is right Dilbert, when writing a program, you should perodically compile it, to make sure there are no errors, then fix any errors as you go along. Sorry I am a noob at C++ so I couldn't really help you with that, now Java on the other hand I could help you with.I found out one of the big problems. A little late, but I did.

As it happens, I needed to access an accessor in another function in an if statement. Trouble is, I was doing this:

Code: [Select]class X
{
public:
   //Other member functions
   bool getVar() const { return theVar; }
   //More stuff
private:
   bool theVar;
};

class Y
{
   //Stuff
   void myFunc(); //Obviously, I wouldn't ever use these classes and function names.
};

...

void Y::myFunc()
{
   if(Ben.getVar())
   {
      //Stuff
   }
}

...

int main()
{
   X Ben;
   Y George;
   George.myFunc();
   ...
}
Imagine my frustration when I found out that I only needed to do this:

Code: [Select]class X
{
public:
   //Other member functions
   bool getVar() const { return theVar; }
   //More stuff
private:
   bool theVar;
};

class Y
{
   //Stuff
   void myFunc(); //Obviously, I wouldn't ever use these classes and function names.
};

...

void Y::myFunc(X Ben)
{
   if(Ben.getVar())
   {
      //Stuff
   }
}

...

int main()
{
   X Ben;
   Y George;
   George.myFunc(Ben);
   ...
}
I was doing that originally, but I forgot why after a week-long break, so I removed them as I couldn't find a reference on it.

However, I discovered this a little late: I'm sick and I was upset, so I ended up using Shift-Delete on the hpp and cpp. Smooth move, Dil-man.

I have a backup from my flash drive (yay!) and I will have about 70% of what I wrote back. But I'm isolating and testing the tBedroom sequence now in a separate hpp/cpp combo. I think this one will compile. As it were, I lost a good chunk of my parser and int main().

This supports Scott Adams' theory:

"People are idiots. That's everyone, not just the people with low SAT scores . . . idiocy is a condition that people slip into and out of every day.

--Scott Adams, The Dilbert Principle


As it were, I've got the cold and the flu, so debugging my bedroom will wait for a while. I've got all day tomorrow... I'm staying home sick. You need this: http://en.wikipedia.org/wiki/Test-driven_development
131.

Solve : remove program?

Answer»

hi, i recently downloaded an antivirus program shareware,from NORMAN.COM.(not norton)i didnt like it so i tried to remove it from add/remove programs nothing happend?so i went to my computer c:/docu-settings/paul.
and it was in the list,i tried to delete it there a pop up said access c:norman denied? so i read how to delete it from the regedit,which i did.
today it is still in my computer c:doc-sett/paul,so i downloaded add/removecleaner.exe from (intelli admin.com) it was in the list of programs so i deleted it and it went. i looked back in my computer c:documents-settings/paul. its still there access denied??(maliciuos spy virus??) can anyone HELP....SORRY for long post...
thankyou for your time..p
It sounds like what you downloaded isn't really an anti-virus at all. Either that, or the worst program ever written.

If you reboot into Safe Mode (how to do that depends on your operating system), it should be possible to remove it. "Access Denied" is usually an error given if the folder or file is being used by the system.hi,dilbert. thanks for your time.
ill try safe mode and let you know how i got on.
cheers........ Quote

hi,dilbert. thanks for your time.
ill try safe mode and let you know how i got on.
cheers........
hi,Dilbert ive tried safe mode and it says access denied can not delete bin,
norman write protected or in use???in the properties list it is read only i could not CHANGE this(still in safe mode)i will end up rebooting from install
cd and wipe the disc clean cause i dont know if it is hacker getting my bank details...cheers..........(unless THERES another way)Oh, I'm not done with this yet. Slippery program, this one... Perhaps the prompt can help with this one:

Start > Run
Type "CMD" (no quotes) and click OK.
Type the following commands:

cd \
cd Program Files\Norman  (<-- Replace "Norman" with the name of the folder that has Norman in it)
attrib -r -a -s *.* /s /d
del *.*

Let me know if that works. Quote
Oh, I'm not done with this yet. Slippery program, this one... Perhaps the prompt can help with this one:

Start > Run
Type "CMD" (no quotes) and click OK.
Type the following commands:

cd \
cd Program Files\Norman  (<-- Replace "Norman" with the name of the folder that has Norman in it)
attrib -r -a -s *.* /s /d
del *.*

Let me know if that works.
hello,Dilbert i tried the cmd prompt (if i did it properly( NOVICE) it said system can not find the patch specified? i found this,if it helps.Norman css MIB file unknown?
i appreciate your help but i dont want to do your head in,do you think it is a hacker?if so ill wipe the disk clean.I don't think it's a hacker. I do, however, think that we've got a really stubborn program, here. I've got one last thing to try.

Download a free program called Ccleaner from here: http://www.filehippo.com/download_ccleaner/

Run it, and go to the button marked "Tools". Find the Norman program, and click "Run Uninstaller". Then click on "Issues" and run a scan. Quote
I don't think it's a hacker. I do, however, think that we've got a really stubborn program, here. I've got one last thing to try.

Download a free program called Ccleaner from here: http://www.filehippo.com/download_ccleaner/

Run it, and go to the button marked "Tools". Find the Norman program, and click "Run Uninstaller". Then click on "Issues" and run a scan.

hi,Dilbert.thanks for the ccleaner..last night i wiped the disc (saved my stuff to cd)up all night,,
many thanks for your time on this one,at least ive found a good help forum!!!cheers p Quote
I don't think it's a hacker. I do, however, think that we've got a really stubborn program, here. I've got one last thing to try.

Download a free program called Ccleaner from here: http://www.filehippo.com/download_ccleaner/

Run it, and go to the button marked "Tools". Find the Norman program, and click "Run Uninstaller". Then click on "Issues" and run a scan.

Hi ...I downloaded this program before but didnt use it because I didnt know if it was safe to. After you run analyze...do you just click on run cleaner and let it remove all that is listed? or do you have to go through the list and make SURE its not deleting anything important...because I have no idea what all those things mean. Quote
Hi ...I downloaded this program before [highlight]but didnt use it because I didnt know if it was safe to.[/highlight] After you run analyze...do you just click on run cleaner and let it remove all that is listed? or do you have to go through the list and make sure its not deleting anything important...because I have no idea what all those things mean.

Surely it is safer than what you DID download.   Quote

Hi ...I downloaded this program before but didnt use it because I didnt know if it was safe to. After you run analyze...do you just click on run cleaner and let it remove all that is listed? or do you have to go through the list and make sure its not deleting anything important...because I have no idea what all those things mean.

Hello lana.  Yes, click on Run to allow CCleaner to delete the items listed.  I have never heard of any problems using CCleaner & regularly use it myself.  Perhaps you could note a few items and do some investigating as to their use, just for interest sake.

However there are no 100% guarantees with anything.

Good luck
132.

Solve : Shopping Cart problem?

Answer»

OK I have a quaetion. I need a shopping cart program, but I am not SURE how to go about this. DO I need to make CODE up for this, or there is a program out there for it. Im not sure were to go from here and I could use some help with this please. Thanks for your hrlp!!!!!ASSUMING your server SUPPORTS php, asp, etc.... You have two options.

1. Try building you own. Your talking about some sort of list or array that holds the items ordered and some way to send this data to paypal or equivalent.

2. Use a pre-built solution such as http://opensolution.org/?p=Quick.Cart They have integration with paypal type companies already written as addons (search their forum).AWSOME thanks for the info. How would I go about building me own shopping cart program. I do not have much skill in this. What can you offer. THANKSStart by learning a server side languge such as PHP or ASP, looking into session variables or even cookies (this is where your program will store details about what is on the list).

That should give you a start...>osCommerce< is free.  No need to reinvent the wheel.  But if you must, you'll need some serious programming skills - then look at PayPal's API documentation for one way of getting started.I have been looking at some of these and I want to build my own shopping cart program, and hints any one can give me for assistants!!!Not for free...Besides that I really don't think anyone on this forum really has time to sit and write a program that tedious.thats not what I am asking. Were can I go to write my own program. Any ideas!!any good placeds to go to obtain the php info, leerning from the experts here.A good PHP Tutorial is only the first step. Pay attention to databases for both for creating your store and holding customer and order information. You'll also need to learn what options are available for maintaining state and which are appropriate under which circumstances.

Good LUCK. 8-)

Could you not start with something a bit more simple than an eCommerce application?  That's quite an advanced project, and you really need some specialist knowledge - e.g. security, the use of site certificates, merchant APIs, etc.  Try downloading osCommerce and having a look at all the code.  There's tons of it and until you actually understand every single line of code, you're not yet ready to build an application like that.

133.

Solve : How to interact with BIOS/CMOS through VB.net?

Answer»

Dear all,
 I need to develop a VB.net application which can interact with BIOS to display the PC Health Status. Anyone can help?

 Thank you very much!You can use the management object Win32_BIOS to retrieve some minimum information about the BIOS.

The management objects (WMI) are also accessible through most of the Windows script langauges.

 8-)Thanks for your reply...

But Win32_BIOS DOEN not return properties like CPU Warning Temperature, Current CPU Temperature, Current CPU Fan Speed, VBAT, ShutDown Temperature and etc...anyone can help?

Thank you very much!You're going to hate me for saying this, but I don't think Visual Basic is powerful enough to get all the info you want -- it's too far removed from Assembler.So what is your suggestion? Which programming language/tool is suitable? Please advise...thanks...To be honest, I have no clue how anyone does that. There are programs to do it, so I assume it's possible in a C variant, but I can't find the code. However, there is something you can try -- and you can to it in VB, too!

This program: http://www.majorgeeks.com/download.php?det=311 is called "Motherboard MONITOR". It's a nightmare to install and set up, but once it's in, you can use your program to parse the log it outputs every so often.Thank you very much! Will try that...Fair warning: It is a NIGHTMARE to install and set up. I can't believe it's so complex. Oh well, it could be worse. Quote

I need to develop a VB.net application which can interact with BIOS to display the PC Health Status

You might want to check out the Win32_TemperatureProbe class which has nothing to do with the BIOS but might prove helpful.

 8-)I tried Win32_TemperatureProbe, but it returns nothing!From what I could DISCOVER, the System Management BIOS REFERENCE Specification is only implemented by some motherboards. Accessing SMBIOS with WMI and the CIM data model only works with WinXP-Pro and Win2003 Server.

This article may help: SMBIOS

You could check with your motherboard manufacturer for drivers that could read this info. You can check, but I'm fairly certain you won't find anything in the Windows API for this.

Good luck. 8-)
134.

Solve : how can i block a URL in my browser?

Answer»

hi U out there.........is there any method to block the urls of sites to block'em VIEWING in browsers........like firefox....explorer....etcgo to C:\WINDOWS\system32\drivers\etc , open the host file with notepad. you can enter the sites you WANT in there, dont forget you need the IP address of the site which can be found from http://www.selfseo.com/find_ip_address_of_a_website.php

135.

Solve : Protecting the ENTIRE worksheet (excel 2000)?

Answer»

I am having a headache with Protection right now, as it doesnt seem to include the drop-down list created by Data Validation

I can still modify the CELLS with a Data Validation drop-down list.

If possible, can anyone TELL me how to PROTECT everything BUT selected components? (such as buttons on the worksheet)can anyone help me please? this is a really important function for my program.

Is this for a macro or to do manually? If you NEED it for a macro, the easiest way is to record it by doing it manually and then cutting and pasting the resulting code  into your existing code. If you do it manually, you'll be ABLE to protect various components via checkbox options (Tools==>Protection).

Hope this helps. 8-)

136.

Solve : Deleting program?

Answer»

I created a PROGRAM about a year ago in C and i cannot figure out how to get rid of it when i try to delete it or move it an error MESSAGE comes up SAYING it is being used by another program and all it is is a simple I/O program anyone have any ideas? I would just let it be but it's on my desktop and that's already clutterd enough. ThanksPlease POST the exact message. Have you tried going into safe mode to delete this program? What exactly is on the desktop, a shortcut icon or the program file itself?

If all else fails, there is ALWAYS KillBox

Good luck.  8-)

137.

Solve : Python 3.2.2 problem?

Answer»

Hello. In all honesty, I am asking for help on a homework problem. I've done all that I can on this program, but I still seem to be having trouble. Here is the problem, followed by what I have:

Write a program that declares a different series of lists (lists should not have the same number of words), and ASKS the user how many one-line POEMS she would like to see. In response the program will print that many different poems.

Here is an EXAMPLE of how your program should behave/work (I put in Italics for clarity):

Welcome to the Random Poems of the Day!
How many poems would you like me to generate for you? 3

Here are your 3 poems:

Paris Hilton amazingly eats mice in Duckett House every Sunday afternoon
The cat never runs on the sofa early in the morning
Mrs Christ sometimes runs on the sofa at night

The poems must be centered, with the longest poem starting at the leftmost column. In other words, the longest poem does not have any spaces in front of its first word.
 

  • You will need to use the MAX() function, which returns the maximum of a list of numbers.
  For this problem, I can't seem to understand how to use the max function to center the poems with the longest poem having no spaces in front of its first word. I do have a code for the poems themselves. Here is what I have:
 
 
  •   import random 
  •    
  •   def main(): 
  •       people=["Lil Wayne", "Nicole Richie", "The garbage man", "The Vice-President"] 
  •       verb=["twirls", "shakes", "dances", "yodels", "jumps", "SPITS"] 
  •       adverb=["all the time", "once a week", "ridiculously", "strongly", "frequently"] 
  •       location=["on the hood of the car","behind the stairs", "in front of the principal"] 
  •       time_=["at 1 o'clock in the morning", "at sunrise", "at dinner", "at 8pm", "during brunch"] 
  •    
  •       poems = [' '.join(random.choice(a) for a in (people, verb, adverb, location, time_)) 
  •                    for count in range(int(input("How many poems would you like me to generate for you? "))) ] 
  •       print(""" 
  •   Welcome to Random Peems of the Day! 
  •    
  •   Your poems are: 
  •   """) 
  •       print('.\n'.join(poems)+'.') 
  •    
  •    
  •   main()
  May I please have help with how to use the max function to center the poems with the longest poem having no spaces in front of its first word? I would really appreciate it. Thank you!
138.

Solve : plz help..sql server and visual studio(i'ts urgent)?

Answer»

Hey Somebody has given me Human resource management system folder to connect with both sql server 2000 and visual studio 2008.
I really dont know how to connect
I have two folders
In folder1 there are two files only of FORMAT ".mdf" and ".ldf"
In folder2 there are so many files of "aspx","aspx.cs","aspx.vb" and some folders named"App_Code", "App_Data", "images", "Reports"

here is some info abt my pc:
OS= Windows 7
visual studio 2008
sql server 2000
I have to connect the server.but dont know which folder to connect with which program and how?
please explain step by step.
Dont give me links.as i have googled but there were issues with connectivity.
Thanks for your timeOK. Yo already did the Google search and you found this question has already been addressed by others and now you came here hoping for a different answer.

You are r trying to downgrade. From 2000 to 2008 is a span of eight years. Microsoft does not offer much support for older product. And they do not encourage the use of newer software with older software.

The above is a paraphrase of comments by others.
Why don't you want links? You are not going to find a answer that will neatly fit on one page of this forum. You question is much to specific to dedicate pages to the issue. It is more that knowing the directory.

Here is a brief history of Visual Studio. Some older versions are now free downloads. Have you tried an older version?
http://en.wikipedia.org/wiki/Microsoft_Visual_Studio
Life support
http://support.microsoft.com/gp/lifeselectindex
SQL 2000 documentation
http://msdn.microsoft.com/en-us/library/aa175269%28v=sql.80%29.aspx
http://support.microsoft.com/gp/lifeselectindex

Pardon me if my remarks are not what you want to hear. I am being very FRANK, which saves both you and me some time. Here is a POST that forms the basis of my observations. If he was wrong, then so am I.

Quote

1.) SQL 2000 support has been dropped from all of VS, not just database projects. There is a cost to maintaining providers and the SQL 2000 Engine is much different than 2005 and 2008. With limited resources we have focused on 2005, 2008, 2008 R2 and the upcoming version of SQL.

2.) No, you will not be able to directly deploy to SQL 2000 instance in 2010.  You would have to target 2005 or 2008 and use the script produced and run the script against a 2000 database.  The project and the resulting script is not validated for 2000 regardless of the compatability setting of the database. Validation is driven by the version of SQL you target in the project properties.

We recognize this is not ideal, but is the best it gets for SQL 2000 in 2010.  For customers targeting 2000 we suggest running 2008 GDR and 2010 Side by Side.
Thanks,
First answer on...
http://social.msdn.microsoft.com/Forums/en-US/vstsdb/thread/37d137be-f119-4d49-bddf-99f398328096/

139.

Solve : Problem learning Java?

Answer»

I'm trying to teach myself Java and i'm going through some tutorial i've found on the internet, but i've become stuck. It asks to write a program that when you input a full name (first, middle and last name) it output the initials. So far i have this

Quote

import java.util.Scanner;
public class Initials {
    public static void main(String[] args) {
       
        Scanner input = new Scanner (System.in);
        System.out.println("Please enter your FULL name");
        String name=input.nextLine();
             
        String index = name.substring(0,1);
        int mid = name.indexOf(" ") +1;
        int last = name.lastIndexOf(" ") +1;
       
        System.out.println(index + mid + last);

As you can probably see the output is the first INITIAL then the number of where the other to initials are. Can anyone help ??
Ive changed the middle bit to Char and it still doesnt work, i dont get it

Quote
String index = name.substring(0,1);
        char mid = (char) (name.indexOf(" ") +1);
        char last = (char) (name.lastIndexOf(" ") +1);
indexOf and LastIndexOf return an int, what you need to do is get the character at that position.

the variable "index" ought to be called 'first' to be consistent with the others. But that's more a style issue.

for the middle name, you would use the mid VALUE you have:

Code: [SELECT]String middle= name.substring(mid,mid+1);
String lastname = name.substring(last,last+1);


Naturally, you would change the final System.out.println() call to use middle and lastname instead of the numeric values.
BC, thank you very much, that worked a treat, and know i understand where is was going wrong. I makes perfect sense now, YET an hour ago its was so frustrating.

Thank you again  Quote from: reddevilggg on September 28, 2011, 04:58:53 PM
BC, thank you very much, that worked a treat, and know i understand where is was going wrong. I makes perfect sense now, yet an hour ago its was so frustrating.

Thank you again 

You're welcome

Actually even I hit a snag with that otherwise simple snippet. Since I don't USUALLY use java, I use C#. The string class in C# is similiar, and the substring method is there, but it's arguments are the start, and the length you want, whereas Java takes the start and the end indices. Had me scratching my head trying to figure out why my test (which assumed start,length) wasn't working until I looked up the method in the documentation.
141.

Solve : Web Browser VB.net?

Answer»

Hello,

I am creating a web browser, I have most of the things done however I need help with the following:
-When the user clicks on a link that opens a new window I want the new window to open in my browser not IE.

- When I click on a link to a page I would like the adress bar to show the current url(what is the variable for the current page ?)

- what is the variable for all the text in the web page ?

Thanks

Al968
All the text on web page might be:

objIE.document.body.Innertext

There is also an outertext property

The current page address can be found in:

objIE.LocationURL

Note: change objIE to the name of your browser object

 8-)

Question: if you are writing your own browser would you not have to program all the
 properties and methods involved with a browser?Thanks for your RESPONCE,

Now what I was wondering is how to set the shortcut for a button to be the KEY "enter" (like in IE) so that the browser goes directly to the page when the user presses enter.

Thanks

Al968Are you creating your "own" own browser, or creating a program using VB's built in stuff to access the Internet? If so then you are basically taking a cut down version of IE ANYWAY, just putting your own stuff around it.Yes I now I am Using IE and putting my own stuff in  
Any Advice on the question ??
Thanks
Al968Perhaps if we had an idea of what you're TRYING to do this would go a lot easier. Are you trying to program what a user might do, are you trying to scrape data from a web page, are you automating a task, say downloading?

This is some hefty reading with some invaluable information:
HTML and DHTML Reference


Note: IE is scriptable, depending what you're doing, using VB.NET might be a bit overkill.

Good luck. 8-)The question I am asking doesn't specificly aplly to a browser. The question is :
How can I set my program to run code when at any point the user presses the enter key ??

Thanks

Al968It must have been the post title that threw us off. We I get CONFUSED very easily.

Something like this should work:

Code: [Select]Private Sub txtSelection_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtSelection.KeyPress

  If e.KeyChar = Chr(13) Then

    'enter was pushed, click the submit button
    btnSubmit_Click(sender, e)
  End If
End Sub

Note: Any key pressed while txtSelection has focus will run this code so you can trap any key you want to take action on.

Hope this helps. 8-)

142.

Solve : Learning C++?

Answer»

Hello,

I am interested in learning c++ can anyone point out to me any GOOD tutorial .

Thanks

Al968Good resource, 99,400,000 results. also try http://www.planet-source-code.com/ and http://www.programmersheaven.com/ and http://cplus.about.com/ . Hope that helps  http://www.cplusplus.com/doc/tutorial/The best method is to get a book. However, I am uploading a file I received; I'm pretty sure it's courtesy of Raptor. You'll need 7-zip to OPEN the file, it's free, so Google it if you don't have it. It's a "weekend crash course" on C++. I don't expect this to be the one and only source of info; don't treat it as such. It's designed to help with the basics.

Uh... I'll edit in a minute. It's uploading.

EDIT: http://www.filefactory.com/file/5a7e4b/ (2.83 MB)Thanks for that Dilbert, I was randomly roaming the programming section and I saw that.
Looks fairly easy to understand.
Might help me FINALLY get to learn programming as I said I would ages ago.
Thanks.Thanks for the links, dilbert on your link how do I download the file ??
I can't FIND a download button  

Thanks

Al968Click on "Download with FileFactory Basic", then "Download". The book mentions the Gnu compiler, included on the CD.
There is no CD, but the Gnu software is free - does anyone know where I can get it from?
I searched Google but I didn't know what was what.
Thanks.http://gcc.gnu.org/I did find that, wasn't sure if it was the right one or not.
Thanks for that.OK, I forgot about this, but I'm coming back to it.
Is this compiler just for Linux?
It seems to be not for Windows from what I can gather.
Bear with me, I'm a n00b at this.You can try Borland C++ compiler or DEV C++ compiler. Those are alternatives. Yet, I do not know if the GCC compiler is just for Linux, because I use Borland.

 8-)fffreakThanks, I'll try those.Why don't you just use the free Microsoft Visual C++ Express Edition like everyone else? :-?Why don't you just use Windows XP like everyone else?
Why don't you just use Windows Media Player like everyone else?
Why don't you just eat cookies like everyone else?
Why don't you just get fat like everyone else?
Why don't you just die like everyone else?

All of the above were written tongue-in-cheek, but the point is that some people have different tastes than others. Personally, I don't like Express Edition, and I don't really have a good reason why. But I don't. Some like chocolate, some can't stand it. Some like Express, some don't. Let him have his preferences.

143.

Solve : The VB6 method Inet1.OPENURL downloads just a piece of html code.?

Answer»

I used the VB6 method Inet1.OPENURL in a ROUTINE of mine, but I  alwais obtain just a piece of the html code of the page I want to GET. Why? Thank you to all like answare. (excuse me for my bad english: I am italian).http://support.microsoft.com/kb/232194

Your probably running into this known issue. I have run into similar issues with other languages like DelphiThank you very, very ... much Deve, you was exellent. I hope to find a just update of my very old PACKAGE 'Visual Studio ENTERPRICE'; othewise I will append the code inside the link you posted me.
Any time if I will have any issues I will post it in this site hoping to meet you next time.
Much GREETINGS and good luck for your life, Deve.
Aldo
(excuse me for my bad English)

144.

Solve : Question about Java applets!?

Answer»

I'm helping out a friend with his website and he is using Extreme Tech Weather Station to detect the outdoor weather for his blueberry farm. The HELP I am giving him is creating an applet for the website that will display these results. There already is a Java Swing GUI that utiliizes these APIs, but I cannot get it to work as an applet at all. I can get the layout of it to display on the applet, but the functionality doesn't work at all.

The way it works is that the workstation is connected via USB to some sort of HUB that is connected to a BUNCH of sensors that detect humidity, temperature, and weather stuff like that. When I run the application just as a local application, it RUNS just FINE. But when I run it as an applet, all of the buttons and controls display, but it doesn't do anything after that. The question I have is that I am wondering if this will work at all to have it run as an applet? Are there any certain limitations that Java applets have that are causing this to not work? Maybe this can help: http://www8.cs.umu.se/~jopsi/dass2/applet.html

145.

Solve : Help with Java Random Class for Double values 0-100?

Answer»
Hello,  I am working on a class assignment for my Computer Science class  I have been working on it this week and it is due Sunday and I am not able to discuss this with my instructor.  This is part of a larger assignment and this is the part I am questioning.

The instructions say:

      The cost of a given ROCKETSHIP will be in billions of space credits.  The number
should be displayed using a DecimalFormat object.  Print the number of billions of space
credits just like you would print dollars and cents.  (For instance, 5.75 billion space
credits.)  The price of a rocketship will be between 3 and 20 billion space credits.  To
determine the price of a given rocketship, generate a random double between 0 and 100. If this number is less than 3.0, REPLACE its value with 3.0.  If the randomly-generated
number is greater than 20.0, replace its value with 20.0.  Then use whatever number you arrive at (between 3.0 and 20.0) as the rocketship’s price.   

Here is the output I get:

"Rocketship "Bob" costs 20.00 billion space credits."

Here is sample output:

"Rocketship "Ohio" costs 14.71 billion space credit"

"Rocketship "Illinois" costs 20.00 billion space credit"


I'm not SURE if this correct way to do this assignment

Here is the code I wrote:

            //Randomly give the cost of the ships from  a vaule of 0 to 100 
            costRandom = randomNumbers.nextInt(101);
         
          //If this number is less than 3.0, replace its value with 3.0.
          if (costRandom<3.0)
          {
              costRandom=3.0;
          }
             
          //If the number is greater than 20.0, replace its value with 20.0.   
          else if (costRandom>20.0)
          {
             costRandom=20.0;
          }


I tried:

        costRandom = randomNumbers.nextDouble(101);

and it said there needs to be no arguments



The problem is it only seems to print out just INTEGER values and not doubles.


I understand if you feel you shouldn't help because it a school assignment.

Let me know if you need to see the full code to understand.  Thank you for any help you can give.  This is Java?
Quote
randomNumbers.nextDouble
Looks like NET 4 instead.

But in Java one would see
Quote
Random rand = new Random();
Early in the code.
Did I miss something?I am new to Java and may have made a mistake. I will show what I did.


      // Create a Random object.
      Random randomNumbers = new Random();

      // Create a DecimalFormat object.   
      DecimalFormat formatter = new DecimalFormat("0.00");

      double costRandom;           //Holds the cost of the ships

          //Randomly give the cost of the ships from  a vaule of 0 to 100 
          costRandom = randomNumbers.nextInt(101);
         
          //If this number is less than 3.0, replace its value with 3.0.
          if (costRandom<3.0)
          {
              costRandom=3.0;
          }
             
          //If the number is greater than 20.0, replace its value with 20.0.   
          else if (costRandom>20.0)
          {
             costRandom=20.0;
          }
         
           (earlier in the program I ask the user for  a name)
          //Display Rocketship name ands its cost
          System.out.println("Rocketship \"" + r.Name +"\" costs " + formatter.format(costRandom) + " billion space credits.");

Right  now it is outputting a integer value   for "costRandom" and I need it to output a double value so it have the ability to give both a integer and two decimal places in the output.   I don't know how to turn it into a double.It would be nice to have a thing that souled just convert a integer into a  double.

I don't   know the elegant way to do it, being that I am so lazy and In don't want to do a lot of research, I might just do this.
Have an item that already is a double. Call  it mydouble
get the inter form the random thing 0 - 100 call it myinteger

now say something like this:
add myinteger to itself 5 times. Use a tmp if you wish.
Now say
mydouble = myinteger /5

dividing an integer forces a offloading point do-da-do.
You have a real number in mydouble.

Yeah, I know, not very elegant.
First get it to work. Polish it later.
Code: [Select]costRandom  = (randomNumbers.nextDouble()*17)+3;

Edit, Oh, I see they don't want you to do that.


Code: [Select]costRandom  = (randomNumbers.nextDouble()*100);
if(costRandom > 20)
 costRandom =20;
else if(costRandom < 3)
 costRandom=3;

Or you want to be unnecessarily terse...
Code: [Select]costRandom  = (randomNumbers.nextDouble()*100);
costRandom = costRandom > 20 ? 20 : costRandom < 3 ? 3 : costRandom;
Quote from: Geek-9pm on October 22, 2011, 12:52:39 AM
It would be nice to have a thing that souled just convert a integer into a  double.

Code: [Select]double doublevalue = (int)intvalue;

Quote
mydouble = myinteger /5

dividing an integer forces a offloading point do-da-do.
You have a real number in mydouble.
As you said, you didn't do any research. the division in that expression would be integer division. dividing by 5.0 would force the literal to be a double, I think, thus making the division a floating point operation.Thanks, BC
It is very hard for me to do research. I just use what I can.Thank you very much BC.

The code you suggested below works great for what I needed to do. 

costRandom  = (randomNumbers.nextDouble()*100);

if(costRandom > 20)
 costRandom =20;
else if(costRandom < 3)
 costRandom=3;
146.

Solve : perl write from array to text file issue?

Answer»

So reading in file to array is easy since it automatically assumes read all to eof. But when writing back, I GUESS you also need to tell it to write back all to end of array to the file, and so do I need to create an incremental loop writing back each value from the array until I hit nul or is there a better method? perl has lots of quick ways to shorthand get the job done. I was originally thinking it would be happy assuming to write all values from the array back, but it writes nothing to import2.txt

Code: [Select]#!/usr/bin/perl
# Read, Alter, Write, and Read and display to show change in alt file

open(DATA,"<import.txt") or die "Can't open data";
lines = <DATA>;
close(DATA);

print lines[0];
print lines[1];
print lines[2];
print lines[3];
print lines[6];

$input = <STDIN>;
lines[6] = $input;

print lines[0];
print lines[1];
print lines[2];
print lines[3];
print lines[6];

open(DATA,">import2.txt") or die "Can't open data";
lines = <DATA>;
close(DATA);

open(DATA,"<import2.txt") or die "Can't open data";
lines = <DATA>;
close(DATA);

print lines[0];
print lines[1];
print lines[2];
print lines[3];
print lines[6];
In import.txt I have the following test data

1
2
3
4
5
6
7
8
9
0

Was hoping I was going to be able to place data DELIMITED like 1,2,3,4,5,6,7,8,9,0 but maybe its more efficient for the data to be 1 character per line format. Probably should get into multidimensional arrays for data grouped like

1,2,3
4,5,6
7,8,9

Arrays are my weak spot right now with writing back from them. Reading in and passing data to them is easy. Years ago in C++ I remember something about incrementing to eof or in this case End Of Array to write data from array back to file.If the data does not fill the array, where is the logical end of the array?  There needs to be some way to count the number of items in the array that are valid data items.output to a file would be something like this:

Code: [Select]open(DATA,">import2.txt") or die "cannot open import2";
print DATA lines

what you appear to be doing is USING perl shorthand to try to read from the file each time; you are ASSIGNING the file variable to the array, which results in the array being populated from the file.

147.

Solve : Symbian S60 development in C++ help!?

Answer»

Hi. I have a Nokia 5230 Nuron which runs on the Symbian S60 5th Ed. OS. I've been wanting to for a while to start developing QT apps for it, so I just recently installed the Qt SDKs which CAME with Qt Creator as the IDE for it, and I also have App TRK and CODA on my phone for debugging on the phone, but the problem is that Qt Creator will not detect that my phone is connected at all. Under the project window and under which COM port to use, it remains blank. My computer detects my phone being connected no problem, but this is not working. Anyone who maybe has run into a similar problem before your help is HUGELY appreciated. WOW! That is an impressive set of tools. Sorry I am not help.
Others might want to know more about what your a re doing. There is a series of videos on You Tube about this kind of development.
http://www.youtube.com/watch?v=U7yje3D1UM4
Maybe there is something in the series that will give you a hint.

It may help if you tell what OS you are using on the workstation. Also, some information about then workstation. Do you have a utility to confirm the nCOM port is properly set?  Not always easy.

Also, do you hate other phones then work fine with then debugger? Have any of your peers used a similar system with good results?

Using it with a COMM port can be difficult. Why not use USB instead?

This may be of interest:
Quote

...  successfully compiled and built the QT FRAMEWORK on my WINDOWS Laptop using MinGW C/C++ compiler and installed QT Creator 0.9 alpha as my IDE. I originally got complimation working with Eclipse but opted for QT Creator as it looks handy since it made especially for QT.

I am not going to go straight into coding without designing my program first, what is needed etc so I decided I’d be best working out how to do serial I/O. Serial I/O is very simple on Linux since everything on Linux is a file! /dev/ttySxx is usually the file associated with the serial charactor device. But this is no good on my Windows PC so I searched for a POSIX based Serial I/O class or library. Luckly a POSIX library for Serial Comm was developed for QT. The project is located at http://qextserialport.sourceforge.net/. I downloaded version 1.1 to see how easy it would be to do serial communication.

So I took at a look at the QT project file and saw TEMPLATE = lib so this project builds a library what is expected. I navigated to the directory and done a qmake to create the Makefile and a mingw32-make.exe to build the library using MinGW and QT. (I had to set my path to ensure that all the minGW bin utilities were found system wide set PATH=%PATH%;C:\MingGW\bin. After the building I found two files in the build folde ..
http://automon.donaloconnor.net/qt-and-qextserialport/34/
As you can see, the workstation OS haws a impact on the use of serial ports. If it is Windows.  You may wish to reconsider using USB instead.Thank you for your reply, geek-9pm. The OS I am running on my workstation is Windows 7 Professional 64-bit. Here's some basic information about it:

OS: Windows 7 Professional 64-bit
CPU: AMD Athlon 2 X2 2.8GHz (dual-core)
MOBO: ASUS M4A785TD-V EVO
RAM: 4GB Kingston DDR3-1066
GPU: ATI Radeon HD 4350 512MB

I built this completely from scratch and I love it. I hope this doesn't sound confusing at all, but where it asks for a COM port to connect to in Qt Creator, it is looking for a USB port. Maybe I just read it wrong, I don't know. But yesterday I tried it again, but this time I plugged in my phone via USB upon booting up and I let the OS install the drivers for the device and this time it installed some serial port drivers, so I started Qt Creator and everything ran fine! It read the USB port my phone was connected to and I was able to run programs that came from the SDK on my phone which was amazing. So I'm thinking that maybe the whole problem was me not letting the OS install the necessary drivers, or something like that.

I will take a look at the youtube videos for further insight into what I'm getting myself into, but thank you again for the help. I still have yet to get CODA working on my phone for on-device debugging because it looks pretty cool and fun to use, but I will once again keep you updated if I run into anything. Thank you Glad I was of some help. Sure would like to know how far you get with this. Writing new applications for mobiles devices sounds like a great idea. The world is going mobile.  Desktops computers are too big for most consumer users. Like  the old Grandfather Clock, they will become just collector's items. 



[regaining space - attachment deleted by admin]Ha ha, could you imagine if everyone had to carry around a grandfather clock and if mobile devices didn't exist?! The world would be entirely different, that's for sure.

So far with my Symbian phone, I have one new app created and installed on it, but that's it for now. It is a simple GUI that lets you type in a string into a box and it adds it to another box, so it's not much for an app, but it works. It will obviously take a while to get something cool going because I still have to learn Qt's APIs first probably by reading the API documentation. I do have some pretty sweet app ideas for the FUTURE though.
148.

Solve : Calculate weight of word?

Answer»

I am trying to alphabetize by generating a weight of a word, saving those numbers, and then comparing which numbers are greater. Don't ask me why I need to do this way.

So I am trying to come up with a function that calculates the value of a certain word. I am using the asc function to get the ascii value, but I am not good enough at math to figure out how to calculate this.

Here is what I have:

Code: [Select]Dim byt As Integer
Dim acc As Integer

If txt = "" Then
    lbl = "0"
Else
    For i = 1 To LEN(txt)
        byt = Asc(Mid(txt, i, 1))
        acc = acc + (byt / i)
    Next i
   
    lbl = Str(acc)
End If
Quote from: Linux711 on October 12, 2011, 09:48:10 AM

Don't ask me why I need to do this way.

Why do you need to do it this way?

Quote from: Salmon Trout on October 12, 2011, 10:56:40 AM
Why do you need to do it this way?

*whispers* because its homework ?? Quote from: Linux711 on October 12, 2011, 09:48:10 AM
I am trying to alphabetize by generating a weight of a word

It's not really clear what the "weight" of a word is supposed to mean. Maybe if you made that clearer? Do you mean that some letters are "heavier" than others e.g. A weighs 1 unit and Z weighs 26 units? Something like that?

Quote
*whispers* because its homework ??

To be honest, yes, but that's only about 10% of it. The rest I already have completed.

Quote
It's not really clear what the "weight" of a word is supposed to mean.

Ok. I'll try to be clearer. What I need is a algorithm that will take a word and return a value of that word, so that it can be put in alphabetical order. 'A' weighs whatever the ASCII value of 'A' is, etc. So I began by just adding all the ASCII values together, but that was not correct because the first character takes presidence over the rest because "aa" would come before "apple". Do you see what I mean now?It's not as simple as you seem to think it is.

these are in alphabetical order

a
aa
aaa

You can't just "sort" one string. The whole essence of sorting is comparison.

Quote
You can't just "sort" one string. The whole essence of sorting is comparison.

True, but you could generate a value based on that string, right? Quote from: Linux711 on October 12, 2011, 01:25:29 PM
True, but you could generate a value based on that string, right?

So what value would the string "a" have?
PROBABLY 97, but I'm not sure because my algorithm doesn't work. Any help? Quote from: Linux711 on October 12, 2011, 01:53:16 PM
Probably 97, but I'm not sure because my algorithm doesn't work. Any help?

You are using the word algorithm incorrectly. There are sorting algorithms, sure, but like I said, you can't sort one string.

Quote
my algorithm doesn't work

This is a great big fat clue.

Quote from: Linux711 on October 12, 2011, 01:04:04 PM
"aa" would come before "apple"

... and "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa aaaaaaaaaa" would come before "ab". Do you see the difficulty now?


MAY I but in? Think of the letters as being part of a number system from some space aliens. For this example, we shall only  lower case letters from a to z. The letter am by itself, has a value of 1. the Letter z, by itself, has a value of 26. Also, the hyphen will be given a value of 0. (More of that latter).
These space aliens  have asymmetrical bodies with with fingers and toes that add up to 27. So they count things in groups of 27 or a power of 27. The have adopted the letters a-z and the hyphen for their number system.
So in their notation:
1 = a
b = 2
and so on.
Now look at this:
a-  represents 27, but
aa  represents 28  and
ba  represents 55 also
b-a represents 1459
We told you earlier the hyphen in their language represents a zero, it is a plaice holder.

Myself, I can not do this in BATCH code. I would have to use VB-script. Or maybe Python.

It is a form of base conversion. Using base 27 as the source. Computers don not work in base 27, so it needs to be in a common base that is used in computing. Likely a 64 bit long integer.


Geek isn't getting it either.
Quote from: Linux711 on October 12, 2011, 09:48:10 AM
I am trying to alphabetize by generating a weight of a word, saving those numbers, and then comparing which numbers are greater.
It won't work.

What you are basically trying to do is generate a hash. The problem with a hash is that a collision is inevitable,especially with one so simple and comprised of so few bits. and in the case of sorting by a hash any collisions will end up sorting together.

The only time I've needed to so anything remotely similar to this was when I was writing a Anagram search program that could find all anagrams of a given word from a dictionary list. Rather  than a sequential search and compare, I sorted the list of words according to the sorted list of their letters; that is, the word "parent" would be sorted as "aenprt". So would "entrap". This means that all anagrams of a given word would end up being sorted contiguously.


However, what you are trying to do, again, is hash the word, and then sort based on that hash. Since a hash will always lose some information, there are going to be collisions.

Quote
Likely a 64 bit long integer.
limited to 14 characters. - I think, my math may be a bit rusty, I got that from log base 27 of 18,446,744,073,709,600,000 (~2 to the 64th power); (and it's been a while since I've dealt with logarithms). And that is for a unsigned 64-bit long, too.


Doable, maybe. But as a general purpose sort algorithm? fairly useless. Especially since it can only represent the alphabetic characters and in a single case (lower case or upper case). Additionally, it doesn't give any sort of speed advantage since surely hashing (which will pretty much be what is being done) the characters into a 64-bit integer is going to be more work than simply comparing two strings, particularly since the latter case only has to compare the strings up to the point where they differ; it's a O(n+1) operation where n is the number of letters that are the same at the beginning of either string. Hashing (or converting base, or whatever you want to call it) will always be O(n) for the length of the string. Add to this the fact that VB6 (which it appears they are using) doesn't support 64-bit integers except by faking it with the scaled 64-bit integer that is the Currency TYPE, and you add a whole new meaning to the word "overcomplicated". Not to mention said 64-bit scaled integer is in fact a signed value.
149.

Solve : [Java]Using a map key as a string?

Answer»

In Java, is there any way to use a map key as a string to manipulate?

Say I was storing:

Key:Jennifer
Value:123456789

in a map, is there anyway I could access the key "Jennifer" as a string?

As it stands, I have a hashmap that STORES (string, INT) key/value pairs and I wish to access the key for use as a string.

Here's an example of something I'm trying:

Set set = map.entrySet();
Iterator i = set.iterator();

while (i.hasNext()){
    Map.Entry me = (Map.Entry)i.next();
    System.out.print (me.getKey().length());
}

This doesn't seem to work.

Right now, I'm creating a set from my HashMap using .entrySet() and then using an iterator, I'm creating map entries from the map and extracting KEYS using get.key().

However, it doesn't seem like it allows me to perform typical string functions on it like .length() or .substring(x,y)

I appreciate any insight into this.I couldn't get your example to compile.

but here is mine. seems to work fine:


Code: [Select]import java.util.*;
public class testmap {
    public static void main(String[] args) {
      HashMap<String,Integer&GT; testmap=new HashMap<String,Integer>();
     
     
      testmap.put("Billy", 500);
      testmap.put("Jerry",400);
      testmap.put("Lisa", 40);
      testmap.put("Jennifer", 80);
     
      Set<Entry<String, Integer>> grabset = testmap.entrySet();
      Iterator<Map.Entry<String,Integer>> i = grabset.iterator();

      while (i.hasNext()){
          Map.Entry<String,Integer> me = (Map.Entry<String,Integer>)i.next();
          System.out.println (((String)me.getKey()).length());
      }
     
     
     
     
    }
       
}

Oh, I seems like casting me.getKey to a string did the trick, like you did in your code.

Thanks.

150.

Solve : Problem with vga to 3 rca cable?

Answer»

hi all,

i have bought vga to 3 rca cable (this has green, blue and red wire) and when i am connecting it in my tv it is not working. i am also not aware whether it will run directly or requires some other setings or any thing as.

my tv is of bpl purchased on 2002 which has 3 ports one for VIDEO and two for audio. when i am connecing my cpu with tv nothing displays

can some one let me know the procedure or what setting i have to select in my cpu

thanks

 This is a component input cable. Does your television have a Component input? It will be labeled Y/Pb/Pr. Y is video, Pb is audio LEFT and Pr is audio RIGHT. Component can not connect to standard video input.i have told that i have 6 pins port in my tv above top 3 are for outputs and below 3 are for inputs from which one is red white and yellow

 If this is a laptop, then you have to change the display to output to the tv. Right click on desktop and the options should be there. btw you don't call it a cpu, the cpu is a chip inside your comp. Quote from: bobsklarservices on October 25, 2011, 11:19:49 AM

This is a component input cable. Does your television have a Component input? It will be labeled Y/Pb/Pr. Y is video, Pb is audio left and Pr is audio right. Component can not connect to standard video input.
You've got this a bit mixed up.  These are video only, not audio.
Component Video
Y carries luma (brightness or luminance) and synchronization (sync) information.
Pb carries the difference between blue and luma (B − Y).
Pr carries the difference between red and luma (R − Y).

Composite is probably what he has on the TV, since he said:  "...has 3 ports one for video and two for audio..." Quote
Composite is probably what he has on the TV, since he said:  "...has 3 ports one for video and two for audio..."
Right. The VGA does NOT have audio on it. So the VA adapter he has is not a composite output device.

I has a VGA to composite adapter and the quality is, IMHO, not worth the trouble, The device is a small box that requires power from the USB port. Nice gadget, but the image is really poor.
EDIT: This COMPANY has it, but the price is high.
http://mycablemart.com/
I do not have laptop i am connecting from my computer that is desktop.

now let me know in details. what setting i have to change Quote from: Geek-9pm on October 25, 2011, 04:57:53 PM
the image is really poor.

That is because composite Video sucks, especially at higher resolutions than the NTSC standard.

The best one can hope for with systems that utilize Composite is that they might also allow for the use of S-Video, which is a tad better than composite video. I use a Composite Video cable that also has a S-Video lead with my old game systems and the results are noticably better.

Quote
i have bought vga to 3 rca cable (this has green, blue and red wire)
That is a component video cable.

Quote
which has 3 ports one for video and two for audio.
And that is composite video/audio- Yellow for video, white and red for the two audio channels. They are not compatible, in any way, with a Component cable.

Quote from: umap on October 26, 2011, 06:42:52 AM
I do not have laptop i am connecting from my computer that is desktop.

now let me know in details. what setting i have to change

Go pick up and old CRT monitor, round here theyre giving them away, and people are CHARGING to get rid of them, do SOMEONE a favour and take their old one off their hands.

Better picture quality

For the settings, you dont have to do ANYTHING to the computer, you just need to select the right input on your TV.

I recommend a CRT over one of these adapaters anyday, but its your choice.