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.

2301.

Solve : A program in Debug??

Answer»

(Posting this because I couldn't get a straight answer from google, so I've written up how I did it incase anyone ELSE runs into the same problem)

While using my palmtop (HP200LX!!), which runs MS-DOS 5.0, i decided i needed a batch file to ask a yes/no question and get an answer. Unfortunately, under MS-DOS 5.0, there is no way to accommodate this. There wasn't even the program 'CHOICE' on it. While flicking through my manual, I saw something that said
"A very common form of use of Errorlevel depends on a short program not usually found on MS-DOS DISKS called YN. This returns an errorlevel of 1 if the n key is pressed when the program runs."
I didn't have this program, so i decided to make one myself using something I'd never used before: Debug.
After a bit of googling, and looking on


i had my source code ready!
Code: [Select]0100 mov ah, 01 ; keyboard input subprogram. all the examples have an h after 01, is used, but in debug remove it or else face an error.

0102 int 21h ; read character into al. Removal of h not necessary here

0104 cmp al, 79 ; compare al with the hex value of lowercase y, 79

0106 jne 010D ; jump if they're different to line 010D

0108 mov ax, 4c00 ; return to ms-dos. Errorlevel 0

010B int 21h

010D mov ax, 4c01 ; return to ms-dos. Errorlevel 1

0110 int 21h
The next step was to enter it into debug. Using instructions from
I entered the code, using these keystrokes.

Code: [Select]C:\>DEBUG
-N YN.COM
-A
0100 mov ah, 01
0102 int 21h
0104 cmp al, 79
0106 jne 010D
0108 mov ax, 4c00
010B int 21h
010D mov ax, 4c01
0110 int 21h
0112
-RCX
CX0000
:10
-W
00010 Bytes Written
-Q
C:\>

Now, my program was ready!

Note: RCX and its 10 input was used to SET the number of bytes that needed to be written. (Hexadecimal 0110 - 0100 = 10) The write command will not function without RCX being used first.

Heres the example i used:

Code: [Select]@echo off
echo Press y or n...
yn
echo.
if errorlevel == 1 goto n
if errorlevel == 0 goto y
:y
echo You pressed Y!
goto end
:n
echo You pressed N...
:end
Anyways, if you ever need a YN substitute i hope this helps! Cheers XDI like it.
It should work in 32 bit mode . There are no memory references.
Just standard calls into the OS.

JNE is a relative jump inside the code area. But you can even eliminate that... but let's not go there. You have done enough!

Simple is beautiful. Quote from: Geek-9pm on December 23, 2009, 05:15:01 PM
I like it.
It should work in 32 bit mode . There are no memory references.
Just standard calls into the OS.


Well yeah, once it's properly compiled into a PE executable rather then a COM file, it can run in 32-bit mode.So I couldn't try and run this as it is in windows?I tried it, made it using debug again (in the command shell in xp) and it made it and all, but it doesn't seem to be setting the errorlevel correctly, either that or the batch program i made to use it isn't working properly. Otherwise, it works exactly the same as it does on my palmtop.Ok, I've worked out that the program is not returning the correct errorlevel, so I don't KNOW how to do that in XP... doesn't really matter though, i'd just use "choice" under XP.Ok, something very weird just happened.
Every time I ran the above program in ms-dos, it ran slower and slower. Soon, if I pressed 'N' the program would crash. I decompiled it using debug and i saw two things:
1. JNE had been changed to JNZ.
2. The second int 21 (line 0110) had changed to a series of 6 commands, things like "add [si,al]" (not sure about that though.) I don't know why.
The last time I ran the program it crashed altogether, freezing my palmtop. I had to flash its memory. What went wrong???
2302.

Solve : Shell script and batch programming?

Answer»

Hi all,

I have following function in shell PROGRAMING and i NEED to write the same for batch programing .
Can someone help me out in doing that.

function get_dir
{
local DIR_SETUP=abc/default/setup.sh
if [ -N "$DIR" -a -f "$DIR/$DIR_SETUP" ] ; then
echo $DIR
else
if [ -f $DIR_SETUP ] ; then
PWD= /bin/pwd
else
local CUR_DIR=$PWD
DIR1=
while [ \( ! \( -f $DIR_SETUP \) \) -a \( $PWD != "/" \) ]; do
cd .. > /dev/null
DIR1=`PWD= /bin/pwd`
done
cd $CUR_DIR > /dev/null
if [ -f "$DIR1/$DIR_SETUP" ]; then
echo $DIR1
fi
fi
fi
}

Thanks In advance
and one more thing i know is there is NOTHING like function in batch programming.
so i can use something like setlocal and endlocal.
while loop is also not works in batch programing but yes for loop is workingthanks
I found the workaround for it as we can not apply too much conditions in batch files hence we use the other WAY around

2303.

Solve : Problems recovering Toshiba Laptop?

Answer»

I sure hope someone can help me. I own a Toshiba Satellite laptop. It runs Vista Home Premium Service pack 1. It's almost 2 years old. A year ago Windows failed to load and I had to recover my computer to the orginall "out of the box state"
Slowly I have had more and more issues, CD burner issues, Windows Explorer, and various other issues.... Today I restarted as it was running slow, and it would not fully boot back up. It would give my my desktop, but lock up whenever i clicked on anything. I would ctrl-alt-delete but it would just give me a black screen. After I attempted Safemode with no avail, I had to power off AGAIN and it wanted to chkdsk. I let it do so. It said it fixed errors but they went by too fast for me to know what they were. I booted up to my desktop again but had the same problem, again. So I decided to pop the recovery disk that came with my Toshiba in and revert back to "out of the box" again as I have all my stuff backed up. It went all the way through disk 1, asked for disk two and was somewhat though recovering when it said I had a "Toshiba Recovery error 10-FC12-045D" Everything I'm reading says it means my hard drive is defective...but I can't get a definate answer... I'm hoping not... HELPI think either the recovery CD or the hard disk is faulty. The large number of chkdsk errors makes me think it is the hard drive. If that was my laptop I would be thinking that it should go to a repair shop for a TEST and maybe hard drive replacement. I would be comparing the cost of hard drive replacement with the cost of a new laptop.

Have you looked here?

http://www.techspot.com/vb/topic130938.html

There is a discussion of that error CODE and a link on that page to download a Toshiba diagnostic tool which is in a zip file. You would need to (obviously) download it on a separate (working) computer. Then you would prepare a DOS boot floppy disk (your laptop has a floppy drive?) and place the unzipped diagnostic program on the floppy. Finally you would boot the laptop from the floppy disk, and following the instructions in the text file also in the downloaded zip file, run the diagnostic test. If you do not feel confident to take all these steps, you should realistically take the laptop to a repair shop.


I am afraid that my laptop does not have a floppy drive.... I do think that I could take those steps, things can't get too much worse, and I HONESTLY do not have it in my budget for a computer tech. Also I have recently moved to a new area, a very small town, and don't know who I would trust.... I also know that I think that getting a new hard disk would probably be better for me. I spent about 1,500 on this laptop, and I am not one that can be happy with a basic laptop or netbook. But I also dont' know the prices for a new hard disk and getting it installed, as I know there is no way I could do that by myself. I really do appreciate your idea... if you have anything else let me know....I'm desperate!!!Quote from: arkgirl1989 on December 19, 2009, 03:19:14 AM

But I also dont' know the prices for a new hard disk and getting it installed, as I know there is no way I could do that by myself.

A lot less than 1500 DOLLARS. A hundred or (maybe) two. A new laptop hard drive costs from 80 dollars upwards depending on size. A repair shop might charge 50 dollars or so on top to remove the old hard drive, fit the new one, and reinstall Windows.


That is some comforting news.... one more question, and call me stupid on it.... haha I know alot about some things on a computer but def. not all this, this is new for me.... So here's the stupid question.....
I guess theres no way I could use that tool with a CD & not a floppy?Not a stupid question at all; You can make a bootable DOS CD and put the Toshiba tool on that.


Sorry it took me so long to get back to you. I took my computer to a local repair place, and they were able to recover it without any issues. I just got it back Christmas Eve... I'm glad I don't have to have a new hard disk, but I'm still back to the beginning so I'm reloading everything. I just hope it stays fixed! Thank you for all your help!
2304.

Solve : Internet and web page development?

Answer»

Quote from: kareem eltanahy on January 01, 2010, 02:49:18 PM

i am not so good at html so i was trying to find an easy way to develop a web page

yeah, ok, go with html, or, you could use one of the wysiwyg type tools that geek suggested. I'd say a good compromise is to use one of the tools mentioned and occasionally TAKE a peek at the html source and see how changes affect the HTML.Quote from: BC_Programmer on January 01, 2010, 02:52:59 PM
yeah, ok, go with html, or, you could use one of the wysiwyg type tools that geek suggested. I'd say a good compromise is to use one of the tools mentioned and occasionally take a peek at the html source and see how changes affect the HTML.
okay but thanks for the advise all of you......I might as well take this opportunity to give a LINK to my own site:

http://www.webdesigntuts.net/design-software-tutorials/list-of-common-html-editors.htmlNice list. It includes SEA Monkey!
http://www.seamonkey-project.org/
It is the tool of CHOICE for a beginner.
Or a lazy, tired old-timer. Like me.
Quote from: Geek-9pm on January 01, 2010, 03:51:44 PM
Nice list. It includes Sea Monkey!
http://www.seamonkey-project.org/
It is the tool of choice for a beginner.
Or a lazy, tired old-timer. Like me.



your even older than i am

seamonkey is it only tools to make a web site or do they put it on the web for you and others to see

i don't know the correct words to use , is it hostYes, it can handle it. Takes a little bit to understand how the FTP thing works. But it does work.all of you thank you very much . Quote from: Geek-9pm on January 01, 2010, 03:51:44 PM
Nice list. It includes Sea Monkey!
http://www.seamonkey-project.org/
It is the tool of choice for a beginner.
Or a lazy, tired old-timer. Like me.

nc one thanks very muchwhat is this sea monkey web browser Sea Monkey looks and feels like the old Netscape.
Like Netscacpe, it is a three in one.
We Browser
e-mail
Composer

The composer is as good as any bare BONES WYSIWYG editor. Gives good quality HTML without your need to know HTML codes.


Try it! You will like it! Or your money Back!
- It's Free!thanks about it
2305.

Solve : Creating simple batch file, how do i invoke a response if sucessful?

Answer»

Hi ,

I am looking to create a VERY simple batch file that creates a directory structure

below is the code i have created

@echo off

@pause
echo on

@mkdir C:\Temp\test11

@mkdir C:\Temp\test\sample11

@pause


This works very well in the creation of the FOLDERS. It also works very well if the batch file is run again , because it comes up with a warning to say that the folders already exists.

I would like to add a message to say that the files were created successfully IF they did not exist.
If they already exist then the COMPUTER response is more than sufficient.

Also i would like to add a command to say "press Enter to exit app" , rather than the pause command

Any pointers graciously accepted.
After a bit of researching I managed to COME up with a solution to your request:

@echo off

:CREATE1
IF NOT EXIST C:\Temp\test11 md C:\Temp\test11
GOTO :MSG1

:CREATE2
IF NOT EXIST C:\Temp\test\sample11 md C:\Temp\test\sample11
GOTO :MSG2

:MSG1
ECHO Creation of C:\Temp\test11 successful.
GOTO CREATE2

:MSG2
ECHO Creation of C:\Temp\test\sample11 successful.

REM choice /c: /n "Press enter to exit the app"

pause


However, I still don't know how to CATCH the Enter key with the CHOICE command.

Hi , Thanks for your THOUGHTS!

Because the program will only ever make the same folders , I didnt need to go down the road of making a variable

In the end I settled on ...

@Echo off
pause

if exist d:\test echo Folder test Already Exists
if not exist d:\test md d:\test & echo Folder test Created

if exist d:\test\sample echo Folder sample Already Exists
if not exist d:\test\sample md d:\test\sample & echo Folder sample created

if exist d:\test\sample1 echo Folder sample1 Already Exists
if not exist d:\test\sample1 md d:\test\sample1 & echo Folder sample1 Created



But still no further forward on the 'press enter to exit' .. although , for purposes i'll just stick with the pause command

Thanks again
TimJust saying:

Use the %errorlevel% variable. If %errorlevel% is not 0 then there was error. So, use this code after your desired code. Errorlevel gets reset after each command run.

If not %errorlevel%==0 Echo COMMAND FAILED. Quote from: o0timbo0o on January 20, 2010, 08:51:54 AM

But still no further forward on the 'press enter to exit' .. although , for purposes i'll just stick with the pause command

You can use set /p to wait for a string terminated by ENTER. The string can be zero length (i.e. just ENTER by itself)

Code: [Select]set /p dummy="Press the Enter key "
The variable "dummy" is so called because it is just a throwaway & is not used for anything.

2306.

Solve : have two computers in my office on same network and cant get complet email on on?

Answer»

I have two compuyers on same wireless NETWORK in my office and use internet explore on both systems. when i use msn hotmail ACCOUNT it works great on one monitor and on the second monitor i only get LOWER portion of any EMAIL message i open ! what do i NEED to do to change this ! I also use same service at my home and have no problem with email messages

2307.

Solve : Need help with DAO/jet db engine?

Answer»

First off, I am not a programmer, but am pretty literate so far as repairs and troubleshooting, etc. Here is my dilema; I have a test panel that the software was written in Windows 95, apparently with the DAO/jet db. We have recently MOVED the software to a new PC with XP Professional. The software installed, but will not run without the jet db....when trying to open I get error messages that the db is not available. I found a download CALLED jet35sp3 that lets me open the program, but I still have no printer communications (needed to print reports).....anybody GOT any ideas, like I said, I am not a programmer, but I am sure that there is something out there?The Microsoft Jet Database Engine has been around for awhile.
Here is my observation, based and piratical experience, not theory.
If the APPLICATION is still working on an old 95 machine, just leave it that way.
And make backups of everything if it is important to you.Jet/DAO is a database engine- not a database. Is the error about missing dlls or about a missing database?i understand that; no the old 95 is not working, that is why the company sent us a tower set up with xp pro. they installed the 95 program in compatibility mode thinking that is all it needed. the program will open, but will not communicate with the printer. All they get is an opus22 COM 1 error

2308.

Solve : Program to output into text box?

Answer»

Hey,

One of our servers constantly ask for domain username and PASSWORD, which is really annoying as our password is very long.

what i am TRYING to do is create a sheduled task that runs after its PREDECESSOR which prompts for username and pass and get it to TYPE in my username + password and hit ok.


i know in dos you can output to a text file by

@echo off
echo username* >> username.txt
echo password* >> password.txt

this would save my daily job and put it in a scheduled task.

help would be greatly appreciatedWell if you know how often it prompts you? You can set your batch file to open at intervals with the scheduled tasks manager.

Batch won't be able to add text to text boxes, but if you can get your program to recieve the username and password from a file, then you're good to go!wasnt my program so scimming THRO all the code will be difficult..
any external programs that will do it?A macro? Something like Autohotkey is good to use.

2309.

Solve : What is the code to make the text fit??

Answer»

Can someone help me I wanted to know what the html code?To make it fit in, AROUND, threw, on what? You need to ELABORATE.

2310.

Solve : Html Coding?

Answer»

I wanted to KNOW how I can MAKE the text fit? How would you like to stop making multiple posts of the same thing?

This is your other post, USE it.I did that by accident THANK you very much. Do you know the answer to my question or what?To make 'text fit' I would say use

mytext

.
Or the not so good way:

my text

my text balbalablablabla
2311.

Solve : Check for registry key c++?

Answer»

How do I check the (Default) REGISTRY entry in c++ and return TRUE, if exists, and false, if not.Earlier, I SAID I wanted to check if it existed or not. I meant to check if it is empty.

I tried using the RegQueryValueEx function, but when I put NULL for the second param (which should supposedly READ the (Default) entry) it always gives me NULL for the entry even if there is something in it. So how do I read (Default) VALUE and determine if it is empty?

2312.

Solve : PHP - read text file on click?

Answer»

Good day to all,

HEY guys, I'm writing a small project for myself and I need some help. I can read the file names from a folder using readdir function and set the names as links to the file destination.

How do I go about making a script that will read the contents of the text file that was clicked on?

EX. Main folder called: root

/root/file1.txt
/root/file2.txt
/root/file3.txt

On the WEBPAGE the script will read each file name and print them on the page as links like this:

...file1.txt
...file2.txt
...file3.txt

When I click on the link the file will OPEN in the browser directly, but I am looking for a way of identifying which file has been clicked so I can open that file for reading and manipulate the contents inside.

Any help is appreaciated, thank you.Nvm, PROBLEM solved.

2313.

Solve : Error on 'else' in statement. Java.?

Answer»

Hello. I am trying to make a menu in java USING an 'else if' statement.

Code: [Select]if (Selection == 1)
{
Thing 1;
}
else if (Selection == 2)
{
Thing 2;
}
else if (Selection == 3)
{
Thing 3;
}
else if (Selection == 4)
{
Thing 4;
}
else if (Selection == 5);
{
Thing 5;
}
else
{

}

For some reason I am getting an error on the last 'else' in the statement. If I delete it then the program will do what ever is selected but it will then also do the 5th thing. If I add an 'if' to the end of the else it will still show an error just on the 'else'. Does anyone know why this is happening and how to fix it?

Thanks.Ye man, you got a semi-color ( ; ) after fifth else if statement brackets.

here: else if (Selection == 5); <-- REMOVE it.By the way I'm assuming you're using console to do the menu. What do you use to READ the keyboard input? When I started learning I jumped right into the JOptionPane.Quote from: ultimatum on January 25, 2010, 11:07:31 AM

a semi-color ( ; )

a semi-colon

Thank you so MUCH. For user input the only way I know of is to use a scanner which you IMPORT.
2314.

Solve : computer sign in?

Answer»

Can some one tall me why i have to SIGN in when my computer start up.
Can some one tall me what to do about it.
Can some one help me please.What does it have to do with "C" or programming?Why? To prevent unauthorized access to your files. Would you like every TOM, *CENSORED* and Harry snooping through your personal stuff?For the same REASON you have to input your pin code when paying with your debit card. Even though it's yours it prevents unauthorized access to your account.On XP:

Control Panel -> User Accounts -> User Accounts -> Remove my password

2315.

Solve : PHP - Exception Handling won't work!?

Answer»

I'm trying to catch a general exception in PHP using try and catch blocks.

This is my code:


$a = 5;
$b = "word";

try
{
$c = $a+$b;
}

catch (Exception $e)
{
echo "Message: addition failed."
}

echo $c;


?>

I placed a string in $b variable on purpose to test the exception handling but when I run the application I get this error:

Parse error: parse error, unexpected '{' in w:\home\localhost\www\...\phpdesigner_tmp6.php on line 7

Line 7 being the try { code.

Any idea why this happens? Is there any adjustments I have to make in php.ini for this to work? Any help is greatly appreciated.

Thanks.Looks like a very easy error to me.
You can't calculate Strings with numbers.Quote from: Treval on January 21, 2010, 11:53:43 AM

Looks like a very easy error to me.
You can't calculate Strings with numbers.

That would have been a run-time error, and in fact, I don't think it would cause a problem.

The issue is actually caused by a missing ; on the "addition failed" echo line.

Code: [Select]<?php

$a=5;
$b="word";

try
{
$c=$a+$b;
}
catch(Exception$e)
{
echo"Message:additionfailed.";
}

echo$c;


?>

it doesn't trigger the exception, but it only shows 5; since + is only defined for numbers. You'd expect that to raise an exception, but it doesn't. In fact, it doesn't even cause an error.

Even as it is now, the try...catch won't catch runtime exceptions, like division by zero; because these are (for some reason) handled by the interpreter itself; in fact, the only exceptions you can Catch with a Try BLOCK are the ones you Throw yourself.

You can cause errors to be handled as exceptions if you define your own error handler routine:

Code: [Select]function errorHandler($number, $string, $file = 'Unknown', $line = 0, $context = array())
{
if (($number == E_NOTICE) || ($number == E_STRICT))
return false;

if (!error_reporting())
return false;

throw new Exception($string, $number);

return true;
}

set_error_handler('errorHandler');

It still won't catch the issue with + and strings; although I suppose that is more the domain of a warning. It will catch things like division by zero and file not found errors, though.

EDIT: is it just me, or is my first code tag syntax highlighted?Quote
EDIT: is it just me, or is my first code tag syntax highlighted?
Yep, you forgot your PHP opening and closing tags in the second.Quote from: kpac on January 21, 2010, 12:26:38 PM
Yep, you forgot your PHP opening and closing tags in the second.

naw, I didn't forget them, since it is supposed to be inserted WITHIN existing PHP Thank you for your replies. I ended up using error suppression in my php code. I've done some research and I noticed not many people use exception handling, for the most part it is just avoided using if and else statements.

Do any of you use exception handling?I used it in my java exam. lol.
Custom error throwing and catching elsewhere.

But that's java.
I use it in Java as well.C#, VB.NET, and I used Win32 SEH (Structured Exception Handling) for a while in C++, but I haven't used C++ in quite some time. I sort of use Exceptions in VB6; one of my projects has a INFRASTRUCTURE that sort of emulates Exception handling. It obviously doesn't have it's own syntax; but it emulates it pretty well.

I haven't really used Java for a long time (back when AWT was the WAY to create User Interfaces) it had exception handling then, but I don't think I actually used it (most of my projects were pretty trivial). My favourite feature in the newer languages that have developed has got to be generics. They save a ton of typing.

With regards to PHP, I think that Exceptions are more useful when your using Classes and have an object heirarchy; most PHP pages don't really need their own set of objects, and usually errors can be handled in-line, so it's really not something you see a whole lot of.Now there's Swing in java.
2316.

Solve : my little project?

Answer» QUOTE from: Treval on January 27, 2010, 02:56:06 AM
Did you brush your TEETH, BC?



I was pointing out that my quote was specifically REFERRING to the unit you mentioned.
2317.

Solve : softwares?

Answer»

hi guyz iam abhinay iam a newbie over here i need to get an info abt the software adding LIKE is there any way to add two setups of different mode into a single one with out installing them in usuall way.....

To do that do i hav to b a proggramer r a familiar person who updates his computer KNOWLEDGE in frequent times.....

thanx in advance....

plz do reply......hedo, it ssss [emailprotected] 2 undastad yuz wen dount tiiipez riteSmall translation for the REST of you:

Introduction
Hi guys I am abhinay I am a newbie over here.
I need to get information about adding software together.

Question
Is there a way to add two setups (.msi?) of different modes into a single one
without installing them the usual way?..."


Extra information about the computer knowledge of the person
To do that I have to be a programmer or a person who is familiar with computers
and frequently keeps his computer knoweldge up to date.
Thanks in advance...

Please do reply...

---------------------------

So, abhinay, are you asking to make a single install setup out of 2 different install FILES (.msi)?
Cant Understand Perfectly
Explain In Brief SINCE the OP hasn't responded in almost 2 months I seriously doubt that they are going to now.

2318.

Solve : programming through C?

Answer»

Took me three tries to read your second line, Joker.

Why Do You Capitalize The First Letter Of Every Word?Cant Help

I 've Got A Habit of It Quote from: the_mad_joker on January 31, 2010, 01:21:48 AM

Cant Help

I 've Got A Habit of It

Well, maybe it's TIME you gave it up, at least on here. Along with various other unfortunate little "habits" you seem to have, it makes you come across like a dumb cheeky trolling kid, which I am sure you would wish to avoid, not least because it makes PEOPLE less WILLING to answer your questions.

Quote from: the_mad_joker on January 30, 2010, 11:06:02 PM
There Is a Thing called "Ethical Hacking"

No there isn't. Is there something called ethical burglary or ethical theft? No. "hacking" has come to mean BREAKING into computer systems without permission. It's burglarly. Penetration testing is not "ethical hacking", because it's done by professional PROGRAMMERS and security experts; maybe they to be hackers, but now they are professionals. a hacker is by definition unskilled (trust me, I've seen threads in "professional" hacker forums where people spend pages trying to simply attach a picture).

Penetration testing, on the other hand, is done with the permission of the owner of the system; this is equivalent to having a burglary test done on your house.

2319.

Solve : Select first value on a gridview asp.net C#?

Answer»

Im codiing in asp.net in C#.

I'm trying to select BY Default the first radiobutton value of my gridview.

Could someone please help me out here?


Thanks,
Laura

This is my current CODE for my aspx page:


<%

@ Page Title="" Language="C#" MasterPageFile="~/Site1.Master" AutoEventWireup="TRUE" CodeBehind="merchantsearch.aspx.cs" Inherits="Template1.RegistrationSummary" %>
<

<

asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">script language="javascript" type="text/javascript">


{







{



function select_first()var table = document.getElementById('<%= Gridview1.MerchantMID%>');if (table.rows && table.rows.length>0)//Here you need to use 1 for first row. because 0 means its refers the header row in table.







{



{

chkChecked.checked =



}

chkChecked = chkChecked.nextSibling;

}

}

}

var firstrow = table.rows[1]; var CELL = firstrow.cells[0]; var chkChecked = cell.firstChild;while(chkChecked)if(chkChecked.tagName=="INPUT" && chkChecked.type=="radio")"checked";break;

script>





Merchant search page


Merchant MID:   







Or/And









Merchant name:



















Text="Search" onclick="buttonSearch_Click_Click" />








ContextTypeName="DataClasses2DataContext" EnableDelete="True" EnableInsert="True" EnableUpdate="True" TableName="dbmerchants">







CssClass="mGrid" GridLines="None" AutoGenerateColumns="FALSE" PagerStyle-CssClass="pgr"






AlternatingRowStyle-CssClass="alt" AllowSorting="True" onpageindexchanging="Gridview1_PageIndexChanging1">







HeaderText="Category ID"/>





































select_first();


















I had to seriously reformat your code for the programmers out there to help you better:

Reformatted code

2320.

Solve : Upload in ASP?

Answer»

Hi everyone, I just want to make an application developed in ASP to upload a File to a server URL address, without using Activex controllers, only code.

Regardshttp://www.w3schools.com/asp/Thanks, Excellent site.

RegardsW3schools is a bad website with deprecated code.
I wouldn't go study there if I were you.Quote from: Treval on February 01, 2010, 08:22:45 PM

W3schools is a bad website with deprecated code.
I wouldn't go study there if I were you.

really? I wouldn't say it's that bad. although their are a number of pretty big wtfs on that site; which I read about in the following threads:


First, a pretty simple typo I imagine... mentioning netscape at all on any semi-modern web dev site is a pretty solid *censored*:
http://forums.thedailywtf.com/forums/p/5558/118770.aspx


This one lost a LOT of my RESPECT that I had (at the time) for w3schools:

Quote
Executables, C++ (and Java too) must die

Neither C++ nor Java can ever create standard components that can run on all computers. There is no room for these languages in future distributed applications. Executables are not standard. COM objects are not standard, DLL-files are not standard. Registry settings are not standard. INI-files are not standard. None of these components must be allowed to destroy your dream of a standard distributed application that will run on almost any computer in the world.
Evidently, w3schools is completely unaware that all the browsers that will make this possible are executables; additionally, there is plenty of room for them all in the future, since, as stated they will be required to run all these script languages that they tout as "more standard". additionally, as stated by one of the posters in the thread, C++ is simply a language not necessarily a binary format. and of course java is purposely designed for use on different computers/operating systems.

http://forums.thedailywtf.com/forums/p/5607/119511.aspx

And they continue their Anti-compilism attitude:

http://forums.thedailywtf.com/forums/p/5164/113272.aspx

namely:
"Our best suggestion is to use a standard Internet server like Internet Information Services (IIS), with a standard request-handler like Active Server Pages (ASP), and a standard database connector like Active Data Objects (ADO)"

Most CURIOUS, they say that "COM Objects are non-standard" and yet fail to realize that ADO is based on COM. they really should at least try to be a little more consistent.
http://forums.thedailywtf.com/forums/p/5164/113272.aspx

The fact that they mention netscape anywhere on the site (not sure if they do anymore, these threads are pretty dated) WOULD be a pretty big one.

In any case... I really cannot think of anything that I've seen there that is deprecated... any examples Treval? (seriously curious). I've always thought they were all gung ho on doing away with nearly every HTML attribute and tables and frames in order to replace them with CSS that anti-thetically has to be parsed by their arch-nemesis, the entity they call "compiled code". From what I've seen it's a good reference, even if their goals are ridiculous and stupid and they are completely inconsistent in what they are.

Quote from: Treval on February 01, 2010, 08:22:45 PM
W3schools is a bad website with deprecated code.
I wouldn't go study there if I were you.
I learned everything I KNOW at W3Schools and am now using valid XHTML Strict 1.0 code on all pages I design.

Quote
First, a pretty simple typo I imagine... mentioning netscape at all on any semi-modern web dev site is a pretty solid *censored*:
http://forums.thedailywtf.com/forums/p/5558/118770.aspx
http://w3schools.com/browsers/browsers_netscape.asp

Quote
In any case... I really cannot think of anything that I've seen there that is deprecated... any examples Treval? (seriously curious).
They do mention some codes, but they do say that they are depricated. It's up to the user to choose from then on.
2321.

Solve : Help with reading a certain file in C++!!!?

Answer»

Hi. My name is Tim and I have a QUESTION that regards reading from a FILE. The file that I WANT to read from has the following format: 56 38

2322.

Solve : Sorry, Nm the topic below this!!! I need help reading from a certain file in C++?

Answer»

Hi. My name is Tim and i need some help in reading from a certain FILE with the following format: 56 38 A 7 8. The 56 & the 38 are on the first line, A is on the second, and 7 & 8 are on the third line. What I'm TRYING to do is to make a program that will read this from a file called "inData.txt" without the quotes, and to read this to a file called "outData.txt". This is my program that I can't get to work the way I WANT it to : #include <iostream>
#include <fstream>
#include <string>
using namespace std;

INT main()
{
string line;
bool choice;
ifstream inFile ("inData.txt");
ofstream outFile ("outData.txt");

choice = false;
GETLINE(inFile, line);
cout<<line<<endl;
outFile<<line<<endl;

inFile.close();
outFile.close();

return 0;
}

...And this is in C++. All comments are appreciated. Thx for the help sorry, the "#include " should be on the top of the code

2323.

Solve : PDF to Jpeg?

Answer»

Hi all,
I need to create VBs script file to perfom below activity:
there is place where i will dump my pdf file (in VERSION 9.0) ..say in D drive n TEST1 folder.
now when batch file runs...
1)Open the latest pdf file uploaded in folder TEST1
2)Copy the content to clip board
3)Paste it in mspaint
4)save it in .jpg format in other folder in D drive say TEST2

May be difficult... ,hope to see some solution ... not 100% but some thg which would help my requirement....

Thanks in advance to all,

Regards,
Manisha http://www.autoimager.com/thanks..
any free ware please.. as it will be used for long terms..

RegardsYou MIGHT try NConvertJust curious. Why do you want to do this? Why convert PDF's to JPEG?Hi..
we use a product called EMC captiva.. Then either we can scan the pages or import locally from PC to our application which gets sended to our repository.
while importing there to our application PDF is not getg support..
It supports tif,jpeg ..bmp .
So wanted some help to convert PDF to jpeg ...

Regards,
ManishaThanks for that reply. Does either of the suggested solutions seem viable for your purposes? Hi ,

I have DOwnloaded N convert..The exe does not run.. It says not right 32 bit application.

Regards,
ManishaIs your OS 64-bit or 32-bit ? There are 2 different downloads. Did you get the right one?I have downloaded all n tried..

my pc is 64 bitWhat is the EXACT error message that you get upon trying to install the 64-bit version of NConvert?I downloaded the 32 bit version and it works for me
Code: [Select]Microsoft Windows [Version 6.0.6002]
Copyright (c) 2006 Microsoft Corporation. All RIGHTS reserved.

C:\Users\Phillip\Desktop\Nconvert-win\XnView>nconvert.exe
** NCONVERT v5.54 (c) 1991-2009 Pierre-E Gougelet (Nov 27 2009/10:11:03) **
Version for Windows NT/9x/2000/Xp/Vista (All rights reserved)
** This is a freeware software (for non commercial use)

Usage : nconvert.exe [options ...] file ...
Type nconvert.exe -help, for more information

C:\Users\Phillip\Desktop\Nconvert-win\XnView>
Maybe there is something WRONG with the 64-bit versionwww.media-convert.com



cool TOOL for convert medias

2324.

Solve : Ip Config Batch File Help?

Answer»

I am trying to make a batch file that will re-configure my IP address but It gets stuck in a LOOP on the first command. Im running Vista Home Premium on an HP laptop. Here's my file so far:
IPconfig.bat
==========================

Echo Preparing to Reconfigure IP/DNS...
pause
ipconfig /flushdns
pause
ipconfig /release
pause
ipconfig /renew
pause
echo IP/DNS Configured successfully... Thank you come again!
echo time
exit


=========================

If I could even get it without requiring user input that would be fantastical. I know I could just remove the pause and the echo comments., but it still gets stuck so *censored*>What does the script do when you try to FLUSH the dns?it loops the first command. it seems to flush the dns but it just keeps doing it over and over etc. never going to the next command?!Do the commands at the command line and not in a batch. Do only one command at a time.

C:\>ipconfig /release

C:\>ipconfig /flushdns

C:\>ipconfig /renewthe cause is actually pretty simple:

Quote

Here's my file so far:
IPconfig.bat

if the file is called "IPConfig" then calling "IPConfig" within that batch will simply execute the same batch. Rename the batch file, and it should work fine with or without the pause statements.

As a sort of sidebar, when you type something without a extension (such as for commands, batches, etc) windows (or DOS in the case of an older PC) has to search all path folders for a executable. Executables on DOS were COM, EXE, and BAT files, and were searched in that order. Windows has more extensions, and extensions can be added (and the order changed) but it follows the same basic ruleset, and batch files come last in the search pattern.

So- why is ipconfig.exe not being chosen? well, it searches the current directory first, so it finds your batch file first. OH uh yeah the bat file doesnt include the ipconfig.bat. it only has the text between the hash marks in my orig post. ie: file name xxx.exe contains this
------------------------------------------

hi i am xxx.exe

over

------------------------------------------

see? so it cant be looping itself from its own callout because i do not call to the file within itself. whew. Quote from: BillRichardson on January 03, 2010, 06:43:21 AM
Do the commands at the command line and not in a batch. Do only one command at a time.

C:\>ipconfig /release

C:\>ipconfig /flushdns

C:\>ipconfig /renew

but... that takes the point (and fun) out of making the bat!your batch file is called "ipconfig.bat"

Quote
Here's my file so far:
IPconfig.bat

your subsequent lines that use ipconfig are now simply reentering your batch file.

consider if you have a batch file called "find.bat"

CODE: [Select]echo this is find.bat. how are things.
find /i %1 %2

what HAPPENS here? find .bat calls itself on the second line, because windows searches in the current directory first- the location of your batch file; for any file that has a "pathext" extension; defaults are exe,com,pif,vbs,js, and bat. so the find.bat that is currently executed is run instead of the intended find.exe that is in the system folder.

This is what you are doing, but with ipconfig. rename the batch file to something else and the PROBLEM will probably go away.

2325.

Solve : VB6 keyCode?

Answer»

Hello everybody

I am a starter in VB and I have a question

you know that we us vbKeyF ( for example ) to do something when user press F,

well, what if I want to do something when user TYPE the word hello ( for example )

please with example

thank youkeep track of how many keys are PRESSED, and when the user pressed h,e,l, or o, make sure the COUNT is proper (ie, h can only be pressed when the count is 0, e can be pressed only when it's 1, ETC. And the Else clause can be used to revert the count to zero.

2326.

Solve : Visual Basic 6 help - multi select calender?

Answer»

I am TRYING to add my project a calender. What I cant do is that:

I want to multi select for example from 1 to 5 and/or 10 to 24 days of the month and get data.

Is there a way to do this? Is Calender components enough for is it done by another object?

thanks for any help You can USE the monthView control; (Start->Components Choose "MICROSOFT WINDOWS Common Controls 2 (6.0)")


set Multiselect to True, and maxselcount to 31.

then, you can use the SelStart and SelEnd Properties to acquire the starting and ending dates selected.thank you so so much

2327.

Solve : VBS Script...need to know something?

Answer»

ah right thank you =D it WORKS fine now. cheers for the helpQuote from: thunder708 on February 04, 2010, 03:25:40 AM

ah right thank you =D it works fine now. cheers for the help

yes, and thanks for geek-9pm pointing out the missing addition So this thread can be closed.
But I wanted to ask BC if he has a favorite VBscript Editor and debugger?QUOTE from: Geek-9pm on February 04, 2010, 11:10:26 AM
So this thread can be closed.
But I wanted to ask BC if he has a favorite VBscript Editor and debugger?

I don't work with VBScript much, but I use editpad for editing scripts/text files.Than ks. Looks good. And is FREE for personal use.
EditPad™ Pro
http://www.editpadpro.com/Quote from: Geek-9pm on February 04, 2010, 01:58:07 PM
Than ks. Looks good. And is FREE for personal use.
EditPad™ Pro
http://www.editpadpro.com/

Editpad Lite is free for personal use. Editpad Pro is not.

Editpad Lite doesn't have things like syntax highlighting and other useful (for scripting) features like that. The Pro Version isn't free but it's CERTAINLY worth it (to me)
2328.

Solve : confused with checkboxess need help?

Answer»

I have listview, checkbox on form, and populated them DATA from database.

what is problem is that:

while populating checkboxex all subs related with are running.

for example

form_load runs at start
but

Private sub check1_click()
[COLOR="Red"]HERE ALSO RUNS without my permission at start up. without clicking checkbox[/COLOR]
end sub

how can I prevent this? Does anyone know? ThanksIt would be helpful it you gave some more details.
Are you using This?

.NET Framework Class Library ListView Class
http://msdn.microsoft.com/en-us/library/system.windows.forms.listview.aspx
And which version of Visual Basic? VB 6

I just set the checkbox's value from database in the form_load sub

can it be because of this?changing the value of a checkbox fires it's click event.



Geek-9pm: Actually, I think I can answer that question: for .NET the prototype for the "click" EVEN of a checkbox is something like:

Code: [SELECT]Private Sub CheckBox1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles CheckBox1.Click

the prototype they gave matches the Pre .NET versions of VB though- so it's probably VB5 or 6. So, basically; changing the Value property of a checkbox will fire it's "click" event. So the question is; how to overcome this?

If it isn't causing any problems, don't worry about it. Generally the click event of a checkbox should simply be inspecting the new value and changing other values as appropriate. If your changing the database from the checkbox directly then you should reconsider your design scheme; a database-driven application really should allow for transactional operations; for example, use an "apply" button instead of directly changing the database values.

If however the click even is merely an annoyance and/or for some reason is causing other issues, it's easy to circumvent the default Visual Basic handling of the event.

Alright, so maybe easy isn't the perfect description.

A Checkbox is, internally, the same window class as a button (http://msdn.microsoft.com/en-us/library/bb775947%28VS.85%29.aspx). It's really just a type of button. Therefore, it will respond to the various button messages if we send it directly to the checkbox.

The IMPORTANT Message here is BM_SETCHECK, documented here: http://msdn.microsoft.com/en-us/library/bb775989%28VS.85%29.aspx

But, ALAS! using the sendmessage API to set the state STILL fires the click event! Oh the horror!

The only feasible way to overcome this would be to literally subclass the form and throw away the right notifications from the checkbox (which visual basic would otherwise use to fire events). the bookkeeping involved is enormous, and subclassing for something like this is a bit overboard.

The solution? Well, if your populating and setting the checkbox properties in Form load, you can use a form level variable to determine, in your checkbox click events, wether they should execute. For example:

Code: [Select]
Option Explicit

Private mIgnoreCheckClick as Boolean

Private Sub Form_Load()

'database population, etc...

mIgnoreCheckClick=True

'assign values to checkboxes

mIgnoreCheckClick=False

End Sub

Private Sub Check1_Click()
If mignorecheckclick then exit sub
'normal checkbox code.
End Sub

'etc
I just TRIED but I have many sub procedures and it failsQuote from: linguist2000 on February 04, 2010, 03:16:01 PM

I just tried but I have many sub procedures and it fails

be more specific.
2329.

Solve : Help needed creating a program that prompts for file input and reads it?

Answer»

I need help with this PROGRAM i am creating. It is suppose to prompt the user for the name of file to be read. Afterward it is suppose to read the data within the fileand OUTPUT the record number of the symbol found in the file.Welcome to the computer HOPE forum.
Before a definite answer can be provided, some more detail would be needed. We see you are a beginner. You mentioned a record number. This could lead to the conclusion that you are using some type of database manager. Is that true? And what kind of file are you trying to read?

With the Windows operating system the only built-in language that would be suitable would be what is CALLED VBScript. Are you familiar with this?
Please let us know if you're trying to use any PROGRAMMING language and if you are trying to use a database manager, such as Microsoft Access.Hi,
I agree with Geek-9pm.

There are numerous software development programing languages and you need to provide the exact requirements so we can recommend a programming solution for you.
I work as a software developer so hopefully I (and the other IT experts in the forum) can give you some free advise to solve your problem.
Regards
Steve

2330.

Solve : Open pdf document with password in VB6?

Answer»

Hy,

I like open pdf file with multi password.
The password is computer name and user name.
More person have this routine.
This is possible?

Example: run program, if computer name and user name correct, open protected pdf file automatical.
...
Dim username As String
username = Space(40)
GetUserName username, Len(username)
Label21.Caption = username
Label21.Caption = UCASE$(Label21.Caption)
Dim computername As String
computername = Space(40)
GetComputerName computername, Len(computername)
Label22.Caption = computername
Rem users ************************
If Label21.Caption = "xxxxxxxx" And Label22.Caption = "yyyyyyyyy" Then GoTo user1
...
...
user1: Dim iResult As Double
Dim iPath As String
iPath = "C:\Program FIles\Adobe\Acrobat 7.0\Reader\AcroRd32.exe "
iResult = Shell(iPath, vbMaximizedFocus)
...
...

ThxNone of that makes any sense.... there is no involvement of PASSWORDS, and all it does is start acrobat reader... correction, it start acrobat reader, if it's installed. and it has to be VERSION seven. and it has to be on a 32-bit version of windows. Not very good odds.

There are ways to open a PDF file with whatever PDF viewing program the user has selected, but I'm not sure what you are referring to REGARDING a password. Is it a password implemented by the VB6 program? or a password on the PDF?

the former is possible, but not particularly a good idea- a person could easily open the PDF without the password anyway. The latter also seems a tad silly- when you open the PDF file the user will be prompted for the password anyway.The problem is the next.
Files are provided with password the pdf.
It WOULD be the aim, that not the user types in the password when it opens the file.
If enabled using key is the password-protected file,
then an routine submits the password and ready.

2331.

Solve : php array?

Answer» HI i have this function to convert hex to rgb values

Code: [Select]<?
function hex2rgb($hex){

$rgb = array();
$rgb['r'] = hexdec(substr($hex, 0, 2));
$rgb['g'] = hexdec(substr($hex, 2, 2));
$rgb['b'] = hexdec(substr($hex, 4, 2));
return $rgb;

}

print_r(hex2rgb('ffffff'));

?>

i can SHOW the contents of the array but i am sturggling to use the contents - the atcualy r g b values.

any help?any moderators/admins please delete this THREAD now please i have resolved the problem myself

thanks youIf you don't mind, please POST the solution. It may help someone in the future.Code: [Select]<?php
functionhex2rgb($hex){



$rgb=array();



$rgb['r']=hexdec(substr($hex,0,2));



$rgb['g']=hexdec(substr($hex,2,2));



$rgb['b']=hexdec(substr($hex,4,2));



return$rgb;

}

print_r(hex2rgb('ffffff'));

$COLORS=hex2rgb('ffffff');

echo"<br>".$colors['r'];
echo"<br>".$colors['g'];
echo"<br>".$colors['rb];


?>

2332.

Solve : The Ambitious Project?

Answer»

OK so I'm probably mad but HEY I like a challenge. I have had this idea plaguing me for quite some time now.
I want to develop a new OS. Prob a Linux based system. I'm not a programmer but I am hoping to learn this year. I'm hoping to find a hand full of keen programmers that know enough of this sort of thing to create a team. As I'm not a programmer I'm hoping to lead this project as a project manager. I plan to manage this project via email between the team members involved. If able to learn some programming I will of course take on some tasks myself.

If you're a confident programmer and as ambitious as I am, let me know if your keen to under go this project.

If you think I'm way to far out of my depth and completely mad then feel free to let me know and why you think so.

If you have any advice or suggestions the yes definitely let me know.If possible, can I jump on this bandwagon?

Making an OS sounds really cool...I don't have much experience with actual programming, but I learn quick and am taking a computer science (/programming) course this semester in school, so I could probably get extra marks if I worked in a major colab like this...Yea its possible. More than anything I want people who are truly keen to take part. Obviously though people that know how to program are just as important. I'm happy someone like yourself who is just starting to learn to be a part of it as well. Just either post another message or send me a Personal Message with any related skills you may have and what area you'd be most keen to work on in the project.

Also I should also mention that I'm not expecting this to make alot of money, so anyone interested should be willing to do it for the love programing and the ambition of providing people with an alternative OS. One reason I don't expect it to make alot of money is because I want any charge for it to be as low and a affordable as possible, or as Linux, basically free.Instead of helping I could be an occasional critic.
Ready?

Here are some critical questions.

1. Is the primary reason for the project the desire to learn new group skills? If so, don't you think a conventional face to face meeting would be better that e-mails? But if you want to work over distance, why not use video conferencing?

2. Is one of the objectives is to work on a project that fills a need, how will you find an operating system design that has not already be done?m Why limit the project to just an operating system? A vertical application may put every thing in one package with no line between OS and the application. Embedded software?

3. If an objective is to improve on something that already exists, can you estimate how much time it will take to make a significant improvement? And what about copyright or patent infringement?

4. If another objective is to improve the programming and group skills, how will you deal with the inflated egos some 'programmers' have? Some know only one or two programming methods and will insist that others have to use just those methods. How do you convince them the project is more important than 'proving a point'.

5 If another objective is to promote happy people who work together, how will you face jealous deconstructive and demeaning outside critics who would undermine your harmony?
Hello,

Though I don't intend to discourage the group and the project, I totally agree with Geek-9pm's critics. I've seen and even worked for projects that broke down as a result of egos; point 4 and 5 of Geek-9pm's post.

I'm (we're) ready to help the project though not officially a part of it. Cant promise much contributions from the flight deck of a 747. If the OS you make is "linux-based" then you have to give it away for free minus the cost of your distribution media. No buts.

And if you actually intend to create an entire operating system that is actually something that people would buy I highly doubt you really see the scope of the project at all.


First: you need to will NEED to have somebody who KNOWS assembly. Or you could take code from linux for this part. Except then you'd be bound by the same licensing terms, the GPL.

Then you would need to be able to make calls to the BIOS and CPU instructions to switch to protected mode. This is almost certainly going to require assembly. Or you could copy it from Linux. and be bound by the gpl.

you'll need a boot loader. the basic MBR code will need to load the actual boot loader from disk, which means it will need to understand a file system. your not going to be able to just type out some visual basic or a batch file to get this working. you will need, at the very least, C or another low level language and a good understanding of the file system.

Then you need to write programs FOR the operating system. things like a text editor, calculator, etc. This means that you'll need to write an collection of functions that programs can call. This will require a good understanding of C and calling conventions such as stdcall (pascal), cdecl, etc. as well as how the parameters are pushed and popped to and from the stack during a function call.

And of course, will the PS be text based or graphical? if text based, you'll need a command processor. if graphical, you'll need resources and a good GRAPHIC designer. And of course even more APIs for the creation and handling of various GUI elements, such as buttons, comboboxes, etc. and of course, coding behind these graphical elements and some way for programs to intercept events such as when a textbox changes or when a button is pushed; this will require an advanced knowledge of either virtual function calls or Abstract virtual classes, and in either case is not something that a bunch of amateurs could pull off. Sure, Linux is, pretty much, made by amateurs, but there are also a lot of professionals, and, more importantly, they know what they are doing. Many of them understand C and assembly better then they understand their native language.

So far on your team you have somebody (yourself) who proposes to manage the project, despite having absolutely no experience in either programming, operating system design, or management. And a student who dabbles in batch. I see your team is coming together nicely. at the moment you might be able to compile a C hello world program if you work together on it for a few days.

ANyway: what it sounds like you really want to do is create your own linux distribution. However, like many linux distribution it will have quite a major flaw; in that the only reason for it's creation is not to make the Linux operating system better, but rather to have something that you can say "I did that".

basically, if you intend to make it yourself, even in a best case scenario there is absolutely no chance you could even make a very basic, single-task operating system from scratch in less then a year.

And if you are creating your own linux distro, it's going to need to have something other distros don't. And a cool name can only go so far.I like where you're going with the plan and yes it is ambitious to say the least but, as mentioned already, you have to have a target market to aim for that isn't already covered and there ARE 1,000's of linux distro's around for almost everything. On the other hand consider the average PC user groups:

1)programmers and enthusiasts love to go pulling open the case and tinkering around with the internals or writing code in DOS, not a great market.
2)middle aged or elderly people who just want an easy to use computer for surfing the web and sending e-mails etc, easy to use functionality!!!
3)teenage gamers who use the PC for modding, overclocking and running graphically intense games (.EXE's), here we have heavy resource usage requiring reduced O/S functioning in the background as well as multitasking demand for running multiple programs at once( web browsers/music players/e-mail/social networking apps/etc). Also the o/s has to be able to install programs from .exe files or ~.msi~ as most games are made for windows O/S's. (registry SUPPORT for reg keys)

all 3 groups will want security from viruses and malware (MAC kernel?/Linux kernel?)

so in summary a small sized quick booting easy to use O/S (GUI) that has low resource usage when running, dosen't epic fail with computer viruses but can install and run windows executables alongside its own programs (MAC/Linux or both). I don't envy the task ahead of you Lmao @ Geek9pm. I totally agree with your 4 & 5 points.
I've been programming for 3 years now in college and I'm doing my final project; making an RPG in XNA.
I've done 1,5 years of java, 1,5 of .NET.
Still learning the basics.

I must say really, those 4 & 5 points are true. I've tried so many times to get help on IRC, but programmers have such inflated ego's it's almost impossible to discuss things with them in a normal way. They are also insane. I'm not joking.

I think BC_Programmer is exaggerating with the 1week-for-a-hello-world-program approach. =P
A hello world program takes a few seconds to make.. I could even make the person understand the concept in 5 minutes.

As for making an OS, I think that requires an incredible dedication of spare time for the project alone and tens (ideally hundreds) of programmers.

That's my opinion.
Linus, the Author of Linux was able to reach his goal is a rather short span of time. This interview gives you some idea of what kind of person it takes to get a big project going.
http://www.linuxjournal.com/article/2736
After reading that interview, think about how or why was able to get others to help him.
If you are willing to tackle this project, then start by learning x86 assembly language. If you want to finish quicker and get more instant gradification, then you should use C/C++ to make your OS. However, if you are more interested in the quality and speed of the OS, then you should (in my opinion) use assembly to write the whole thing.

I don't think that you should base it on linux/unix or whatever. If you are going to waste time making an OS, then at least do it right; start from scratch. Once you have learned assembly, there are SEVERAL websites I reccomend you look at to get some design theories.

osdev.org - general forums and a wiki
bos.asmhackers.net - great framework to start from (not a finished project)

And if you decide not to base it off of linux, I would like to join. I have already started an OS project myself, but it is pretty much just a shell that uses BIOS for everything. If you would like to see the code for my OS, just e-mail me.Quote from: alphanumeric on February 11, 2010, 03:47:04 AM

2)middle aged or elderly people who just want an easy to use computer for surfing the web and sending e-mails etc, easy to use functionality!!!

I just love to be patronized...
2333.

Solve : vb6 I made my process critical.....?

Answer»

I made by process a system critical process to if you kill the process it blue screens and then you have to restart. Its a parental blocker I'm making. Anyways the problem is that when you try to shutdown it also blue screens. And I have no idea how to not make it critical. If you want to see the source of the api/module that I am using then I will post it.

And YES I did not make that module I got it from XcryptOR. So credits to him for making it.Someone must know how. It is for a legit purpose so i mean come on...VB6 code cannot run in kernel mode and therefore cannot be directly responsible for a BSOD.

however, a GOOGLE search brought up some INTERESTING results that claimed to run a program as a "system critical" process.

Every single one of them is wrong.

Not a single one of them actually makes the process "system-critical".

What is actually being done, is the process is being modified via ntsetInformationProcess() so that it has two extra flags that indicate:

1.The program is running under a debugger
2.the program should break into the debugger upon termination.

So, when your program is TERMINATED, windows attempts to call an Active debugger on the process, under the false impression that the program is being run under a debugger (due to the changed flag). However, it is NOT and therefore the appropriate Debug information that would be set when a debugger attaches to the process (which is the only legitimate reason for the "running under a debugger" flag to be set, ever). additionally, since this debugging code is in kernel mode and encounters a FATAL error based on some amateur fooling around with process attributes that they really should understand before they fudge with them, it crashes.

Nothing particularly special about it at all- the only thing that has been done to make the process "system critical" is to make it so that the process information is wrong and causes a BSOD when the program terminates, under any condition.

if you want your program to terminate properly, unset the erroneous process information before your program terminates "on purpose".

How?

Well, perhaps you should investigate the code your using to set the erroneous (note how I am constantly saying this? I'm trying to drive home the fact that what you are doing is literally corrupting the internal data structures so they have inconsistent data (saying it is running under a debugger with no debugger attached) process flags.thats actually quite interesting. Anyways i finally found an api (like 10 min ago) that let me change it back to normal and so now they can atleast shutdown windows without getting a bsod.
Is there actually a risk of doing it like that. I mean im sure its not going to blow up their pc but is there a chance that it may format their pc or something of that gratitude?Quote from: hey101 on February 18, 2010, 01:31:29 PM

thats actually quite interesting. Anyways i finally found an api (like 10 min ago) that let me change it back to normal and so now they can atleast shutdown windows without getting a bsod.
Is there actually a risk of doing it like that. I mean im sure its not going to blow up their pc but is there a chance that it may format their pc or something of that gratitude?

No. But since your literally corrupting data, your bound to run into problems at some point.

The way I see it, it's kind of silly to make your process "critical"; terminating the process is only one way to circumvent the blocker. It's just as easy to simply remove the method the program starts with the system and reboot.

In either case, something like a parental blocker should probably be written as a Windows Service. Also, recall that Windows Vista and 7 have built-in parental controls.true which is why im working on methods to prevent the removal of the startup entry. Also believe me when i say that vista or windows 7 built in parental stuff cant even come close to what im doing since mine is done remotely.
its more or less of a parental control than a blocker, but yah...

If I were to make it a service couldnt a user simply stop or terminate the service or set the startup to manual?
2334.

Solve : VBS crypting?

Answer»

Hey guys! I was wondering if there was a way to encrypt a string in vbs? I'm looking for a simple, but secure way to encrypt, then decrypt a string entered. I tried google but the scripts I found just blew me right out of the water. I would like to understand the code, so I can use it later to suit different purposes.your not going to get any sort of serious and reversible string encryption without "blow you out of the water" type code. A good type of encryption for casual use or for FUN is a basic Xor cipher:

Code: [Select]Function CryptXor(StringUse,Password)
Dim I
Dim RetStr
Dim Charuse,CharPwd
For I = 1 to Len(StringUse)
charuse = Mid(stringuse,I,1)
charpwd = Mid(password,(I mod len(password))+1,1)
retstr = retstr + chr(asc(charuse) xor asc(charpwd))
Next
CryptXor = retstr
End Function

Not sure if you've used functions or not in VBScript; my entire script looks like this:

Code: [Select]
Dim strcrypt
Dim strpassword
Dim encrypted ,testdecrypt
Strcrypt = Inputbox("Enter string to Xor:")
strpassword = inputbox("Enter password to use:")
encrypted= CryptXor(strcrypt,strpassword)
testdecrypt = CryptXor(encrypted,strpassword)
msgbox "encrypted:" + encrypted
msgbox "decrypted again:" + testdecrypt

Additionally, there might be a COM object you can create for encryption, but I'm not sure.Quote from: BC_Programmer on February 14, 2010, 11:19:45 PM

I'm really just looking for something to put people's minds at ease. Pretty much, the user will enter their desired string to encrypt, and that string is the en/decryption KEY. That way the string is more-secure...right?Quote from: BC_Programmer on February 14, 2010, 11:19:45 PM
t "blow you out of the water"

Here is some code this will truly blow you out of the water

^^^)*()*&_(&()&*)(*&*

*&(*&(*&*)()(_)(+_(+_(*&&

*&*(&(*5446465454M4♣4♦♦╝4♦4♦É6658◘8b87O7◘7&

X888◘8x8◘◘88◘◘88○99○○9○1☺1☺1☺1☺1☺☺o11♂1☺1111♥♥♥

1☺11☺☺☺7•789999○98Yb8○8○◘98é998○898○88



It was DONE in EEVIAC ++

Although the code may need some revision

I have to agree...that code is totally confusing.Quote from: BC_Programmer on February 14, 2010, 11:19:45 PM
Can I use this in VB6, if so, how?Same way you would from VBS... just copy paste.Quote from: EEVIAC on February 16, 2010, 10:13:43 AM
Here is some code this will truly blow you out of the water

^^^)*()*&_(&()&*)(*&*

*&(*&(*&*)()(_)(+_(+_(*&&

*&*(&(*5446465454M4♣4♦♦╝4♦4♦É6658◘8b87O7◘7&

X888◘8x8◘◘88◘◘88○99○○9○1☺1☺1☺1☺1☺☺o11♂1☺1111♥♥♥

1☺11☺☺☺7•789999○98Yb8○8○◘98é998○898○88



It was done in EEVIAC ++

Although the code may need some revision



is that actually a programming language?Quote from: hey101 on February 18, 2010, 11:51:33 AM
is that actually a programming language?

it's probably the ASCII equivalent of the matching EBCDIC characters resulting from the machine code used for encryption on the EEVIAC.

I'm assuming the EEVIAC uses EBCDIC, which it might not. I'm fairly certain it's too old to use ASCII.Thats confusing but ok. I stil have no idea what EBCDIC or EEVIAC is but thats ok. EEVIAC was an old computer, like UNIVAC.

EBCDIC was a character encoding scheme used before ASCII.Omg i actually understand that i think. lol Thanks.Quote from: BC_Programmer on February 18, 2010, 02:10:32 PM
EEVIAC was an old computer, like UNIVAC.


Lol, actually BC, I think you're thinking of the ENIAC

EEVIAC---Embedded Electronic Variably Integrated Astro Console

Is a record album recorded by "Man or Astroman", an off-the-wall surf type band.. Unless I'm mistaken, they might have gotten the idea from a real computer

and just for the record hey101, they're random keys I types while HOLDING down the Alt key and pressing number on the numeric key pad That what i originally thought but i had to ask.
2335.

Solve : Renaming a batch of files?

Answer»

Well, I have some files that are supposed to be .RAR files, but the splitter screwed up and made it all files that go like .001 .002. 003 etc.

So I'm asking if there is someway to rename all the files to have a .rar extension, doing it singlehandedly is going to take alot of time.

----
EDIT
----

Got the solution, played AROUND with the batch file

REN vty-0116.* vty-0116.*.rarI Sniff Games Form Warez Group ViTaliTy

@ECHO off
Code: [Select]FOR /R NAME_OF_FOLDER %%I IN (*.*) DO ren "%%I" "%%~nI.rar" >nulpause

IT TAKES 2 Seconds To Say "Thanks" Thanks, I have found this very useful and implemented it into some of my batches ALREADY.

2336.

Solve : need clarification?

Answer»

I'm a programming newbie and NEED help understanding what the following code and paragraph is saying..

Code: [Select]
cin.GET(); // add this statement
cin.get(); // and maybe this, too
return 0;
}



"The cin.get() statement reads the next keystroke, so this statement causes the program to wait until you press the Enter key. (No keystrokes get sent to a program until you press the Enter key.) The second statement is needed if the program otherwise leaves an unprocessed keystroke after its regular input. For example, if you enter a number, you'll type the number and then press enter. The program will read the number but leave the Enter keystroke unprocessed, and it then will be read by the first cin.get()"


I understand how the first statement is USED, but I don't understand how the second statement is used.. I don't know what the paragraph is trying to sayI forgot to mention that this is a C++ tutorial I'm reading this out ofI figured this out using a sample program in the book I'm using...
Except I substituted in some string values in other than what the sample code was using...

Code: [Select]#include <iostream>
using namespace std;
int main()
{
int fleas;

cout << "How many fleas does your cat have?\n";
cin >> fleas;
cout << "OH MY GOSH!! " << fleas << " is waaaaay too many. Bath time!\n";

cin.get();
cin.get();
return 0;
}



Output:

How many fleas does your cat have?
100
OH MY GOSH!! 100 fleas is waaaaay too many. Bath time!



The int fleas declaration means that subsequent uses of the word "fleas", being declared an integer variable, will be replaced by a random integer typed into the keyboard after the program is run, and the first output (in this case a question) is displayed.

The first cin.get(); statement forces the program to wait for the ENTER key to be pressed so the program doesn't CLOSE immediately after running.

The second cin.get(); is used to wait for a random integer that must be typed, before pressing enter, and displays the output as shown.. In this case the number was 100














That's very nice EEVIAC. =P

Here is the best book on C++
Deitel C++

Get it! =P
I recommend it so much.

2337.

Solve : Weird C++ program!!!?

Answer»

Hey guys, I have been trying to learn how to do OOP by using classes in C++, and I made a program that compiles, but the output is "256" and i don't know why and I was just wondering what I did wrong. All comments are appreciated. Thanks

#INCLUDE

using namespace std;
class CRectangle
{
int x, y;
public:
Sorry, the program is:

#include

using namespace std;
class CRectangle
{
int x, y;
public:
void values(int, int);
int area() {return (x*y);}
void CRectangle::shapeformat() {
x = 3;
y = 4;
}
};

int main()
{
CRectangle rect_shape;

cout< cout<
return 0;
}I don't know c++
But I was wondering,
Is it normal to have..
{{{
and
}}}}

Why aren't they paired?
{{{, }}}}? Where do you see that at, cuz I wouldn't consider that normal in C++ unless if you have parameters within parameters, you know what i mean. but i dont see that anywhere in the source code.Is the output an error?
I found this:

256 error?

What is 'shapeformat'?Hello,

The C++ COMPILER built into my brain says that it might be a case of uninitialized variables.
Code: [Select]#include <iostream>

using namespace std;

class CRectangle
{
int x, y;
public:
void values(int, int);
int area() {return (x*y);}
void CRectangle::shapeformat() {
x = 3;
y = 4;
}
};

int main()
{
CRectangle rect_shape;

cout<<endl<<rect_shape.area();
cout<<endl;

return 0;
}
In Line No. 10, QUALIFIER `CRectangle::` for the function `shapeformat` isn't necessary. Delete it.
Make a call to `shapeformat` from main().

Make it LOOK something like:

Code: [Select]#include <iostream>

using namespace std;

class CRectangle
{
int x, y;

public:
void values(int, int);
int area()
{
return (x*y);
}

void shapeformat()
{
x = 3;
y = 4;
}
};

int main()
{
CRectangle rect_shape;

rect_shape.shapeformat();

cout<<endl<<rect_shape.area();
cout<<endl;

return 0;
}
NOTE: I have modified the code and did some cleanup to avoid confusions. Try to use proper and uniform indentation, alignment and linespacing so that the code is more `readable`.

Secondly, you've called `endl` before and after call to the class member `area()`. The former CAUSES an empty line which may not be desired. It could be something like:
Code: [Select] cout <<rect_shape.area() << endl;
Geek-9pm,

Maybe you missed this one on Line No. 8:

int area() {return (x*y);}
Ok, thanks for the help and everything, but it still prints out "256." What I wanted it to do is to print out the product of 3 and 4 which is '12'. I know other ways to do it, but I want to know why this code does what it does for educational purposes.Hello,

Quote from: timtim41 on February 12, 2010, 11:48:14 AM

prints out "256."

No chance! Did you call `shapeformat`from `main()`? What compiler are you using? Try a Clean Build. Here on my Linux with G++ (The GNU C++ Compiler):
Code: [Select]$ g++ -o newfile newfile.cpp
$ ./newfile

12
$
I saved your code as `newfile.cpp`(after making the modifications shown in my Relply No. 5) and then compiled it to `newfile`.TheUnixGuy's revised program works perfectly fine for me as well with Visual Studio 2008.

Quote from: TheUnixGuy on February 12, 2010, 03:16:05 AM
Hello,

The C++ Compiler built into my brain says that it might be a case of uninitialized variables.
Code: [Select]#include <iostream>

using namespace std;

class CRectangle
{
int x, y;
public:
void values(int, int);
int area() {return (x*y);}
void CRectangle::shapeformat() {
x = 3;
y = 4;
}
};

int main()
{
CRectangle rect_shape;

cout<<endl<<rect_shape.area();
cout<<endl;

return 0;
}
In Line No. 10, qualifier `CRectangle::` for the function `shapeformat` isn't necessary. Delete it.
Make a call to `shapeformat` from main().

Make it look something like:

Code: [Select]#include <iostream>

using namespace std;

class CRectangle
{
int x, y;

public:
void values(int, int);
int area()
{
return (x*y);
}

void shapeformat()
{
x = 3;
y = 4;
}
};

int main()
{
CRectangle rect_shape;

rect_shape.shapeformat();

cout<<endl<<rect_shape.area();
cout<<endl;

return 0;
}
NOTE: I have modified the code and did some cleanup to avoid confusions. Try to use proper and uniform indentation, alignment and linespacing so that the code is more `readable`.

Secondly, you've called `endl` before and after call to the class member `area()`. The former causes an empty line which may not be desired. It could be something like:
Code: [Select] cout <<rect_shape.area() << endl;

If you don't mind me asking.. How do you run this code? I've got MS Visual C++ 2008 Express ED.

I've only practiced running simple Win32 Console programs..Hello there,

I've never used that IDE but try copying that into the textbox where you type Win32 programs and try compiling it. It should work. BC_Programmer uses that IDE though, maybe he can help. ahh, I see..

If I use "start without debugging" it displays "12...press any key to continue" lollll.. I always use debugging and I have that IDE.
I will have a look at it.
Usually main() will tell VS compiler to run it.

Edit: EEVIAC what the lol?
It outputs 12 for me too. =)
Isn't that normal?..
Since 3*4 is 12.. lol...
I just replaced the entire "stub" program it created with TheUnixGuy's code. ran fine- but the command window dissapeared instantly, so I cheated and added a call to gets() at the end so I could see the result. There's an option somewhere in the project or debugging options to keep it open- at least, I think there is.
2338.

Solve : C# finding a whole number?

Answer»

Hi I was hoping someone might be able to help me.

I have to write a program in C#. part of that program is finding out whether a year is a leap year or not. Now I know that if you divide the year by 4 and it comes BACK with a whole integer number that it is a leap year.

My question is how can I CHECK that the number it comes back with is a whole integer number?Quote from: -kat- on February 21, 2010, 08:47:10 AM

Now I know that if you divide the year by 4 and it comes back with a whole integer number that it is a leap year.
First- this is actually not the entire rule.

A year is a leap year if it's evenly divisible by 4 but not by 100


if (year modulo 4 is 0) and (year modulo 100 is not 0) or (year modulo 400 is 0)
then is_leap_year
else
not_leap_year


Anyway- the answer to your problem is the C# MODULUS operator, %: for example, this function would DETERMINE if a year was a leapyear:


Code: [Select]private bool IsLeap(int year)
{
if ((year % 4 == 0) && (year % 100 != 0) || (year % 400 == 0))
return true;
else
return FALSE;

}
However- a better solution is to simply use the .NET framework. System.DateTime.IsLeapYear(int) will tell you if a specified year is a leap-year.Quote from: BC_Programmer on February 21, 2010, 09:04:05 AM
However- a better solution is to simply use the .NET framework. System.DateTime.IsLeapYear(int) will tell you if a specified year is a leap-year.

Better - but not so much math practice involved... the teacher of the C# class might give -kat-'s homework a low mark if he or she did that!
Quote from: Salmon Trout on February 21, 2010, 09:23:38 AM
Better - but not so much math practice involved... the teacher of the C# class might give -kat-'s homework a low mark if he or she did that!



Yes, that's why I included the other stuff .
2339.

Solve : Weird half image bug?

Answer»

My friend send me a picture. I am on WINDOWS 7 so the icon is the picture but resized. On the icon I see the whole picture but when I open it I can only see exactly half of it. The down part is in BROWN. I tried with Photoshop CS 4, Paint.Net, Microsoft Paint, Windows Photo Viewer and Microsoft Office Picture Manager, but I still CANT see the down part. I used Magnifier to see the icon on the desktop and I saw that everything was OK with the picture. Its like this with only this picture. Please help.The picture PROBABLY got corrupted in transit. Ask for the picture again and see if it works.

2340.

Solve : my hasseler.exe program?

Answer»

Here is my first C++ console app... Very basic... It has an attitude problem so I call it the hasseler.exe program

Code: [SELECT]// THE_Hasseler.cpp
#include <iostream>
using namespace std;
void simon(int);
void simon1(int);
void TEST(int);
void TEST2(int);

int main()
{
simon(3);
cout << "How many times will simon declare next, you dummy?";
int count;
cin >> count;
simon1(count);

cout << "You're on a roll." " Now, tell me how many dinasaurs do you want for Christmas, immediately, or you get nothing.";
int variable;
cin >> variable;
TEST(variable);

cout << "If you're so smart, what's 2 x 2?";
int bob;
cin >> bob;
TEST2(bob);

cin.get();
cin.get();
return 0;
}

void simon(int n)
{
cout << "Simon says TOUCH your toes " << n << " times.\n";
}

void simon1(int n)
{
cout << "You're right, simon has declared " << n << " times.\n";
}

void TEST(int n)
{
cout << "Then you shall have " << n << " dinasaurs, just don't EXPECT anything in your stocking.\n";
}

void TEST2(int n)
{
cout << "You MIGHT be right, but I'm not smart enough to tell yet. HEE HEE";
}

Hi there,

"Attitude problem". Please explain. Copy the code to a C++ compiler and run it in debug mode, and you will see..

When it OPENS up in a console window, it just asks a bunch of silly questions, and after every answer you type (which should be an integer) it will respond and ask another question... There are only 4 questions it asks..Regarding my last user-defined funtion: void TEST2(int n)

It should actually be: void TEST2(), since the output string value contains no "n" variable...

Hm..

When I copy my code off the forum into my compiler it doesn't work

I get an error... How do you copy code into the compiler correctly?


Well, if you can't copy it successfully..

Here is a link from sendspace.comto download the .exe file

http://www.sendspace.com/file/p9csszerrrrr!

Now it seems to be working without any problems, and I can copy and paste without errors.. I feel like an idiot now, with all these excessive posts I can suggest locking the topic though. Quote from: TheUnixGuy on February 21, 2010, 04:29:53 AM

I can suggest locking the topic though.

Why?
2341.

Solve : C++ String problem?

Answer»

As FAR as i can tell i should be able to access the String class in these files , but for some reason it gives me an error every time , i can use Strings inside Main no problem , but if i try to work with them in another Class i get the error "Type name Expected" Referring to the member declaration. any help would be appreciated

#include
class StrTest
{
public:
StrTest();
private:
string test;
};

#include
#include "strtest.hpp"
StrTest::StrTest()
{
test = " ";
}string.h is a C header, not a C++ header, and doesn't DEFINE a string class but RATHER a GROUP of string manipulation functions.

what you REALLY want is just "string" for example:

#include

which resolves to the C++ string header. when you use "string.h" you are specifically referring to the C (non ++) "cstring" header, and are simply adding a group of char* manipulation functions.
Thanks BC , I fixed my problem ...

i included iostream .. i don't know why that worked exactly , but now i know that the String Class is just manipulators.

maybe i should stick to char arraysyour welcome.

including iostream fixed the problem because iostream includes the C++ string headers as well.

Quote

but now i know that the String Class is just manipulators.

err... no, string.h as you included it is just a group of manipulators; it has no class DEFINITIONS at all. the header that get's used by including defines the string class which supports a number of methods/properties. It certainly doesn't have as many as more object-oriented languages such as java and the .NET framework, though.
2342.

Solve : convert furlongs into yards?

Answer»

This program converts furlongs into yards. 1 furlong = 220 yards
You run the program, and it ASKS you to enter a distance in furlongs. You enter a number, press enter and it spits out the equivelent distance in yards.
The conversion I USE in the funtion is 220 * sts

Say I input "9" furlongs, for the program to convert into yards...

It will spit out the number 1980..


But if I input the number 9.5 it still spits out 1980. It should spit out 2090........I would like the program to be able to output the correct VALUE...

tips, anyone?

CODE: [Select]#include <iostream>
using namespace std;
double TEST(double);

int main()
{
cout << "State a distance in furlongs:";
int variable;
cin >> variable;
int bus;
bus = TEST(variable);

cout << "The equivelent distance in yards is: " << bus;

cin.get();
cin.get();
return 0;
}

double TEST(double sts)
{
return 220 * sts;
}
your using cin to acquire a number into a variable...

What data type is that variable? "int" Does the int type support decimals?

ahh..

I believe you struck a point..

I CHANGED the int variable; and int bus; declarations to:

double variable; and double bus; (this works as int bus; also)


Now I get the right output Data types

Whole (integer) numbers (Z): int, byte, long, short

Here's a very good reference for you:
C++ Data Types

Treval

2343.

Solve : Problem with C++ code?

Answer»

Hey guys me again. I am currently working on a program in C++ that is supposed to output the cash total for an international phone call. There is a connection fee, which is $1.99, for the FIRST 3 minutes it's $2.00, and any additional minute it's $0.45 per minute after the first three minutes. I have it working and all and right when you run it, it displays "Enter the number of minutes the call lasted", so I enter a 1 or a 2 and it says "1.99" as it should, when i enter a 3 it reads "3.99" as it should, but then when i enter a four, it skips "4.44" and goes straight to "4.89" but continues from there correctly. The only prob is that it skips 45 CENTS when you enter anything higher than a 3. Here's my program and I have been using Visual Studio 2008 recently. Oh, and also I can't get the ELSE IF statement to take effect. Thx

#include
#include

using namespace std;

int main()
{
CONST double connectFee = 1.99;
double amtDue;
double addMin = 0.45;
int threeMin[] = {3, 2};
int minutes, i;
int addAmt;

i = 3;
amtDue = 0;
addAmt = threeMin[0] + 1;
cout << "Enter the number of minutes the call lasted: ";
cin >> minutes;
cout << endl;

if (minutes > threeMin[0])
{
amtDue = amtDue + connectFee + threeMin[1];

while (i <= minutes)
{
amtDue = amtDue + addMin[1];
i++;
}
}
if (minutes == threeMin[0])
{
amtDue = connectFee + threeMin[1];
}
if (minutes < threeMin[0])
{
if (minutes > 0)
amtDue = connectFee;
}
else if (minutes < 0)
{
cout << "--Invalid input--" << endl;
}
cout << amtDue << endl;

return 0;
}Sorry, on Line 28 the 'addMin[1]' shouldn't have the [1] in it. that looks a tad long for what it does.

here's what I came up with.

Code: [Select]#include <IOSTREAM>

using namespace std;
double GetCost(double CallLength);
int main()
{


double minutes;
cout << "Enter the number of minutes the call lasted: ";
cin >> minutes;
cout << endl;
cout << GetCost(minutes);
//following two lines are for pausing when the program is run from the IDE.
char inme;
cin >> inme;
return 0;
}
//GetCost; calculates the cost of a phone call of the given length.

double GetCost(double CallLength)
{
// connection fee of 1.99 is always charged...
long cost=199;
if (CallLength<=3)
cost=cost+200;
else if(CallLength>3)
{
cost=cost+200;
cost = (cost + (45*((double)CallLength-3)));
}
return ((double)cost)/100;
}

the issue with the original code can probably be solved by changing the code in the first if from:
Code: [Select] amtDue = amtDue + connectFee + threeMin[1];

while (i <= minutes)
{
amtDue = amtDue + addMin[1];
i++;
}
to something like:
Code: [Select]amtDue=connectFee+threeMin[1]+ ((double)addmin[1] * (double)(minutes-3));

2344.

Solve : Batch to VB6?

Answer»

Hi
I have this batch file code:

@echo off
:MAIN
set password=bibo
echo Welcome to SMARTIA. Please enter the password.
set /p input=Password:
if %input%==%password% start Psp.exe

when I RUN it, it gives me what I want but in the DOS poor interface. Can VB6 do the same task with its good interface? and can I add an ELSE statement to write (Sorry, incorrect password). If possible please SHOW me the way

thanks
I don't KNOW any VB6 so I did it in Visual Basic .NET in Visual Studio.
I hope you (or someone else) can translate it to VB6. =)

Here is the code:

Code: [Select]Public Class Smartia

Dim password As String = "bibo"

Public Sub New()
' This call is required by the Windows Form Designer.
InitializeComponent()

' Add any INITIALIZATION after the InitializeComponent() call.
lblWelcome.Text = "Welcome to SMARTIA. Please enter the password."
End Sub

Private Sub txtpw_KeyDown(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles txtpw.KeyDown
If Not e.KeyCode = Keys.Enter Then
Return
End If
If txtpw.Text = password Then
lblSorry.Text = ""
txtpw.Text = ""
Dim RetVal As Object = Shell("C:\WINDOWS\System32\calc.exe", 1)
Else
lblSorry.Text = "Sorry. Wrong password"
End If
End Sub
End Class

Screenshot:
screenshot 1
screenshot 2

Treval



2345.

Solve : Creating a .bat backup program not working?

Answer»

I am trying to execute a backup PROGRAM using notepad then saving the file as a .bat so the at it will execute / run the backup program to save my content to another hard drive. I tried the original code and it WORKED fine it transferred the content in c:\testsource to c:\testbackup when i try to change the destination folder to another folder and tried the program again it did not transfer the content in c:\testbackup to the other folder. Can somebody show me what i am doing wrong.

@echo off
xcopy c:\testsource c:\testbackup /m /e /yWhats the folder you are trying to change it to?

And by the way, it would not transfer the content in 'c:\testbackup' to the other folder UNLESS you had that as the source which is currently 'c:\testsource'? Make sure either this was a typo or you might be doing it backwards. The xcopy DOS command to copy all contents of the c:\testsource directory to the c:\testbackup.

XCOPY is similar to the COPY command except that it has additional switches to specify both the source and destination in detail.

/M Copies only files with the archive attribute set, turns off the archive attribute.
/E Copies directories and subdirectories, including empty ones.
/Y Suppresses prompting to confirm you WANT to overwrite an existing destination file.

You might be having issue with the directory length and/or spacing.If any folder name contains spaces it must be enclosed in quotes. Thank you Azzaboi and BC_Programmer for your tips it worked out.Quote from: alyoob on February 28, 2010, 05:11:22 PM

Here is the folder that i want to transfer to C:\Documents and Settings\HP_Owner\My Documents\My MUSIC
should there be quotes because and you show me how to type it.

Code: [Select]xcopy c:\testsource "C:\Documents and Settings\HP_Owner\My Documents\My Music" /m /e /y

if your source folder also contains quotes you'll need to place quotes around it in the same manner.
2346.

Solve : body mass index calculator?

Answer»

Are you fat?

Use my BMI calculator to find out your BMI, then google for average BMI..


Code: [Select]
#include <iostream>
#include <cmath>
using namespace std;

int main()
{

const int VOOB = 12;
const float ZOOZ = 0.0254;
const float MOON = 2.2;

cout << "HELLO. Welcome to the Body Mass Index calculator!\n\n";
cout << "I will calculate your Body Mass Index.\n\n";
cout << "I HOPE YOU'VE BEEN GOOD!\n\n\n\n\n\n";

cout << "Round down your height to the nearest \"foot\",\n";
cout << "and type it on the line:____\b\b\b\b";

float var1;
cin >> var1;
float A = var1;

cout << "Thankyou. Now ENTER any remaining inches of your height,\n";
cout << "to the nearest inche:____\b\b\b\b";

float var2;
cin >> var2;
float B = var2;

cout << "Thankyou. Now enter your weight in pounds:____\b\b\b\b";

float var3;
cin >> var3;
float C = var3;

float TOTAL_HEIGHT_INCHES = A * VOOB + B;

float HEIGHT_IN_METERS = TOTAL_HEIGHT_INCHES * ZOOZ;

float TOTAL_MASS_in_KILOs = C / MOON;

float SQUARE_OF_TOTAL_mass = pow(HEIGHT_IN_METERS, 2);

float Z = TOTAL_MASS_in_KILOs / SQUARE_OF_TOTAL_mass;

cout << "Your BMI is: " << Z << "\n";

return 0;
}


If you don't want to compile it, download the .exe file here.

It's c++, btwMy BMI is 20. <3
Good job on the app.excellent job EEVIAC, and thanks for giving me and idea for a small easy project to practice my C# a little.

Here's an equivalent program made in C#. I probably could have made the weight input loop without cheating and using a try...catch, but hey, it works. probably a few other little things could be optimized, but oh well.

A NICE little "perk" I added was the height entry- it allows you to enter it directly as something like 6' 7" which I think is pretty neat.



Code: [Select]using System;


namespace bmi
{
class Program
{
static void Main(string[] args)
{
String gHeight;
String gFeet, gInch;
double Height=0, Weight=0;

Console.WriteLine("C# Body Mass Index Calculator");

Console.Write("Enter Your height (example: 4'3\",6'3\", etc):");
gHeight = Console.ReadLine();
int quotepos = gHeight.IndexOf("'");
int dquotepos = gHeight.IndexOf("\"");
gFeet = gHeight.Substring(0,quotepos);
gInch=gHeight.Substring(quotepos+1,dquotepos-quotepos);
gInch = gInch.Substring(0, gInch.Length - 1);


bool erroccured = true;
while (erroccured)
{
try
{
Console.Write("Enter your weight in Pounds:");
Weight = double.Parse(Console.ReadLine());
erroccured = false;
}
catch (Exception ex)
{
erroccured = true;
}
}

Height = double.Parse((gFeet))*12 + double.Parse(gInch);
Console.WriteLine("Entered amount is {0} feet {1} Inches>",gFeet,gInch);


Console.WriteLine("Calculated Body mass Index is {0}",bmi(Height,Weight).ToString());



Console.ReadKey();


}
private static double bmi(double height, double weight)
{
//BMI = Weight(lb) / (Height(in) x Height(in)) x 703
return weight / (height * height) * 703;



}
}
}
Don't forget the metric system!

My optimisation comments on that are:

- Try catching NumberFormat exception first, etc. up to Exception, the most general one.
What kind of exceptions could possibly occur?Quote from: Treval on February 28, 2010, 11:38:40 PM

- Try catching NumberFormat exception first, etc. up to Exception, the most general one.
What kind of exceptions could possibly occur?

That's more of a type cast issue then optimization... I should probably remove exceptions altogether, by using TryParse, actually.heh thanks guys

I'll have to download a C# compiler to try out your code BC, it doesn't seem to want to compile with MS Visual C++, maybe I'm doing something wrong........ I know C and C++ are compatible with each other, but I'm NEW to this game don't know how C# fits in..

I could have actually written the the app. much differently, It was a practice assignment out the book I'm reading.. The assignment instructs to write a program that calculates BMI and to use particular things in the program.. For instance, I could have written it without using const, but the assignment called for storing my conversion factors using it.. Also, I could of had the user display TOTAL height in inches only, and saved the trouble of converting the FT entered, into inches, and then adding the total inches together later (necessary for the bmi formula).. I haven't even gotten to the heart of C++ yet (OOP)...that doesn't come for quite a few more chapters..


I myself am a little over weight I did mine the other day and it was 28.something. It's funny, I couldn't tell that my app. was working until I googled my result, because I had no table or chart to compare my result to... I've never calculated my bmi before..

When I start working soon, as I plan, I'm sure I'll loose some weight.




On a side note, the following code is an interesting little maneuver I pulled off while messing around. It simply convert inches that you enter, into total FT, with exact numbers of inches left over on the side, in decimal format (if a float type is needed)..

It took me a while to figure out how to display the FT and exact inches separately. I was using: INCHES / 12 (for total number of feet, which was assigned to a variable) and a separate expression to extract the remainder of INCHES / 12, which would give me the number of left over inches. I used the modulus operator (%), to extract the remainder and simply assigned that that value a variable and used it for the total left over inches.. The problem was that the modulus operator doesn't work with floating numbers, so if you enter a decimal number in inches, the program output would only be x FT and x inches (with any fractional part discarded) What I did instead to overcome this was use two separate expressions the exact same way (not using the %):
1. INCHES / 12


2. INCHES / 12 - BO //notice how it is in the code

Since the INCHES / FT declaration is a long type (not floating) it cuts of any fractional part that is assigned to its variable... When that variable (BO) is plugged into the second expression, what you have left over is a decimal number in FT, which can then be converted back to inches (VO * 12---also assigned a variable), and will display the exact remaining inches including any fractional part (because the 2nd declaration IS a FLOAT type)

Although I have to admit, I cannot take credit for all of this, an experienced c++ programmer from the cplusplus.com suggested the INCHES / FT - BO idea...
I find it cool how it works, that you count on the long type to drop the decimal part of the output so yo can subtract BO from the second expression..

Note the data types I used... You can enter a pretty big number, up to 64 bit (unsigned long long) in inches and get an exact output in FT , with exact number in inches on the side... Of course you could just enter a number in inches and convert it to a decimal number in FT, but I wanted something that would display the inches on the side...



Code: [Select]
#include <iostream>
using namespace std;

int main()
{

long double variable;
const int VOOB = 12;

cout << "Enter a height in inches:____ \b\b\b\b\b";

cin >> variable;



unsigned long long BO = variable / VOOB;

long double VO = variable / VOOB - BO;

long double WO = VO * VOOB;



cout << "Your equivelent height in FT/INCHES is: " << BO << " FEET, and " << WO << " inches.";
cin.get();
cin.get();
return 0;
}

C# and C++ are quite different (way they work, methods, types, whatevers). =P

height: 5'8"
lbs: 141.75
waist: around 70 cm (which is 35 cm something like that width)
bodyfat: 5%

Check out my cool programming wrist:
wrist

=POh,

As far as the double types (in the INCHES to FT/inches converter) , I should have used just "double" instead of long double to be more efficient in saving memory being used.... Long double wouldn't make any difference anyway, becuase of the long long bottleneck, so to speak..errrrrrrr. I'm very picky about making sure I explain myself correctly and I don't think I did in a couple of cases..

These two statements need to be rectified:



Quote
Note the data types I used... You can enter a pretty big number, up to 64 bit (unsigned long long) in inches and get an exact output in FT , with exact number in inches on the side... Of course you could just enter a number in inches and convert it to a decimal number in FT, but I wanted something that would display the inches on the side..



Quote
As far as the double types (in the INCHES to FT/inches converter) , I should have used just "double" instead of long double to be more efficient in saving memory being used.... Long double wouldn't make any difference anyway, becuase of the long long bottleneck, so to speak..



To ensure the largest possible output in the INCHES to FT/INCHES converter app, a long double should be used.. 1. Because you want to be able to display exact inches left over in decimal FORM 2. You want to leave as much room as possible for the LONG LONG type to work to its full potential, yielding the largest number possilbe. Dividing your INCHES entered, by 12, will yield a number far less than the number of "inches" that you type into the keyboard... So, the largest possible output number is a 64bit number.. The input number being long double can potentially be higher than 64bit.

I hope that makes sense.. Is it me or does min/max come into mind?I didn't use fractions at all- the formula I used requires input in the form of total number of inches, which means you just add the number of feet * 12 to the number of inches. Also, even if you are describing inches as fractional feet, the number will always be rational and within the range of a float/single. Really it makes more sense to allow feet'Inches" to be input, and then parse those out of the string.

C# is a totally different language from C/C++ and uses a different compiler; really, C# is a lot closer to Visual Basic then it is to C/C++.Quote from: BC_Programmer on March 01, 2010, 01:28:42 PM
Really it makes more sense to allow feet'Inches" to be input, and then parse those out of the string.

yes that does make more sense, I don't think I've read about parsing yet, so I'm not sure how to do it.. I'm sure I'll get there, thoughQuote from: EEVIAC on March 01, 2010, 01:36:53 PM
yes that does make more sense, I don't think I've read about parsing yet, so I'm not sure how to do it.. I'm sure I'll get there, though

Yeah, it would take me a while to remember how to do that in C/C++... When I think of parsing I immediately think of the VB6 functions that are used for this purpose and have to "translate" from that for the language I'm using. (with .NET it's easier thanks to intellisense, just plop a dot at the end of the string variable for all the methods that can be performed on a string)
2347.

Solve : Composing a batch to work w/ Windows FTP?

Answer»

Hello all,

I am writing a batch to upload files from my hard drive to the server via windows ftp and batch. I have most of the process worked out, the batch part simply runs:
Code: [Select] @ECho off
REM Use FTP to transfer cache to host computer
ftp -s:ftp.txt
ECHO Process Complete!
pauseWhile the ftp.txt contains this:
Code: [Select]hash
open
(host)
(username)
(password)
bin
prom
mput C:\xampp\htdocs2\Filehost\public_html4\garrysmod\*.*
fastdl\FileHost4\garrysmod\
bye

This is what I have and the result is usually:
Code: [Select]ftp> mput C:\xampp\htdocs2\Filehost\public_html4\garrysmod\*.*
Error opening local file ?????????????????????????.
Error opening local file ?????????????????????????..
200 PORT command successful.
125 Data connection already open; Transfer starting.

226 Transfer complete.
ftp: 995 bytes sent in 0.00Seconds 995.00Kbytes/sec.
Error opening local file ???????????????????????????.
Error opening local file ??????????????????????????s.
Error opening local file ?????????????????????????????.
Error opening local file ???????????????????????????s.
Error opening local file ????????????????????????????.
Error opening local file ????????????????????????????s.
Error opening local file ???????????????????????????.
ftp> fastdl\FileHost4\garrysmod\
Invalid command.
ftp> bye
221 Goodbye.

As you can see my method of transferring an entire folder, is not working. I have searched for days on google, about how to do this, to no avail.
Any helpful advise is much appreciated. IE, don't just post saying what I did was wrong. I know that much otherwise I wouldn't have posted, now would I? The problem is, mput's syntax is:
mput local-files [ ...]

So, an example of the command is:

mput file1.txt file3.txt file4.txt

What you can do is this though:
@echo off
echo USERNAME >> ftp
echo PASSWORD >> ftp
echo OTHER COMMANDS >> ftp
for /f "delims=" %%a in ('dir /b /s C:\xampp\htdocs2\Filehost\public_html4\garrysmod\*.*') do echo PUT %%a >> ftp
echo bye >> ftp
ftp -s:ftp HOST

Not QUITE sure if this will work though, but it is worth a shot.That works great, except that it puts all the files in the same directory. I need to maintain the sub directories. Thanks for your help.PPowerHouseK:

Quote

I need to maintain the sub directories.



Use this script. I have been using it. Works like a charm.

http://www.biterscripting.com/helppages/SS_FTPUpload.html



You don't have to look at the code. They have already written for us. We just use their pre-written script. This script is automatically installed with biterscripting.


It uploads all files under a top directory. It will maintain the directory structure. And, it will create SUBDIRECTORIES as necessary. In short, it will mirror the entire directory structure from your computer to the FTP server. And, it will upload files in appropriate mode, text for .html, binary for .gif, etc.

It's pretty simple to use. All you have to do is to START biterscripting, and enter command.

Code: [Select]script "SS_FTPUpload.txt" ftpserver("ftp.mycompany.com") ftplogin("me") ftppassword("my password") localpath("/mywebsite") remotepath("/pages")

Enter the whole above command on one line. Use correct values in PLACE of "ftp.mycompany.com", "me", "my password", etc. Then, sit back and watch it do its work - directory by directory, file by file.



Thanks so much!!

If this works, im gonna find and seduce you!!

But seriously thanks. I will test this as soon as possible and let you know.Quote from: PPowerHouseK on March 02, 2010, 10:19:09 AM
Thanks so much!!

If this works, im gonna find and seduce you!!

But seriously thanks. I will test this as soon as possible and let you know.
Umm...a little bit over-the-top and AWKWARD...Quote from: Helpmeh on March 02, 2010, 05:28:53 PM
Umm...a little bit over-the-top and awkward...

Precisely what I was going for, it meant that much to me. But don't worry, you're still my favorite. Sorry...I don't do long-distance relationships.
2348.

Solve : Terminating a C++ file with control Z?

Answer» HEY guys, im trying to end my program with control Z,

problem is i have my main() in a loop so i input control Z it just keeps PRINTING lines till it crashes.

i want to do something like:

while (input != controlZ)
(
....
)

although im not sure if this is possible.. any ideas?
Maybe Control Z is filtered by the SYSTEM.
Ty it with some other char and see what happens.
Also, what input/output library did you declare?iostream and string.

my problem is

while (input != controlZ)

because i doubt that is the actual syntax.

if you can help me with this syntax is should be ABLE to figure out the rest

THANKS!
2349.

Solve : form in VB6?

Answer»

Hi
how can I change the NAME of a form in visual basic 6Use the properties window...

I did, but this added the new name to FORM1, stll when I RUN the form it is named form1, !! Quote from: hamoody3 on March 05, 2010, 08:53:04 AM

I did, but this added the new name to FORM1, stll when I run the form it is named form1, !!

IF you want to change the CAPTION of the form, change the Caption PROPERTY.
2350.

Solve : C++ open file based on variabe?

Answer»

Hey guys,

Im trying to open a file based on a variable, HERES what i got.

...
#include

int main()
{
fstream file;
string FILENAME;

cout << "enter file name:" << endl;
cin >> fileName;

file.open(fileName);

}

this doesnt work for some reason, debug error =

error C2664: 'void std::basic_ifstream<_Elem,_Traits>::open(const wchar_t *,std::ios_base::openmode,int)' : cannot convert parameter 1 from 'std::string' to 'const wchar_t *'


any help will be great )))

thanks!I get two errors:


Error1error C2679: binary '>>' : no operator found which takes a right-hand operand of type 'std::string' (or there is no acceptable conversion)

and

Error2error C2664: 'void std::basic_ofstream<_Elem,_Traits>::open(const wchar_t *,std::ios_base::openmode,int)' : cannot convert parameter 1 from 'std::string' to 'const wchar_t *'


But I fixed it...


Code: [Select]#include <fstream>
#include <iostream>
using NAMESPACE std;
int main()
{
OFSTREAM outfile;
string fileName;
cout << "enter file name:" << endl;
fileName.resize(240);
cin >> &fileName[0];

outfile.open(&fileName[0]);
outfile << "This file contains data.";
outfile.close();
}

I don't know if the iostream/fstream libraries allow you to read/write the string class directly... but I didn't want to look that up, so I just went with what I knew.

Basically- instead of trying to pass the class instance to the open() method I PASSED the address of the first character; since this is null delimited the method knows how to read it and is able to open the file. Same story with the cin<< acquisition; just passed it the address of the first character- after allocating with resize(), that is.
BC_Programmer, you are the greatest! works perfect