

InterviewSolution
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)
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
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. 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, |
|
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" 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! 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!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 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 , 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. |
|
2308. |
Solve : Program to output into text box? |
Answer» Hey, |
|
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? 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. |
|
2312. |
Solve : PHP - read text file on click? |
Answer» Good day to all, |
|
2313. |
Solve : Error on 'else' in statement. Java.? |
Answer» Hello. I am trying to make a menu in java USING an 'else if' statement. 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. |
|
2315. |
Solve : PHP - Exception Handling won't work!? |
Answer» I'm trying to catch a general exception in PHP using try and catch blocks. Looks like a very easy error to me. 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 AMDid 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..... |
|
2318. |
Solve : programming through C? |
Answer» Took me three tries to read your second line, Joker. Cant Help 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#. |
|
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. W3schools is a bad website with deprecated code. 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 dieEvidently, 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 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://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> |
|
2323. |
Solve : PDF to Jpeg? |
Answer» Hi all, |
|
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: Here's my file so far: 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. 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: 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 |
|
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: |
|
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. 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 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. 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. |
|
2330. |
Solve : Open pdf document with password in VB6? |
Answer» Hy, |
|
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. 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. 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. 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: 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 PMCan 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 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. |
|
2336. |
Solve : need clarification? |
Answer» I'm a programming newbie and NEED help understanding what the following code and paragraph is saying.. |
|
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 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, 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. 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 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 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 |
|
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 |
|
2344. |
Solve : Batch to VB6? |
Answer» Hi |
|
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. Here is the folder that i want to transfer to C:\Documents and Settings\HP_Owner\My Documents\My MUSIC 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? - Try catching NumberFormat exception first, etc. up to Exception, the most general one. 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 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!!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 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, |
|