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.
| 1101. |
Solve : Displaying my website on all devices / browsers. (ADULT CONTENT WEBSITE)? |
|
Answer» It has taken me over 1 year to DEVELOP my website. I'm self taught. |
|
| 1102. |
Solve : VB .NET Comnectivity check and error handling? |
|
Answer» Hello again. |
|
| 1103. |
Solve : Perl grep help? |
|
Answer» Im using a perl script to monitor the status of 25 VPN tunnels on a Fortigate firewall. The script checks the status on all tunnels en warns me when there's something wrong (Nagios). |
|
| 1104. |
Solve : Begining my first C# project, need pointers (no pun intended)? |
|
Answer» So I've finally decided to start working more in C# instead of VB.NET and VB6. I am starting my first major project and it's going good so far, but I need help with deciding how to structure the program. My idea is to eventually make an above view game (3rd person) LIKE the old Command and Conquer series. To start I am going to use GDI+ graphics because the API seems much easier than DirectX or OpenTK which were inherently designed for 3D purposes. I am probably going to lower the screen resolution if it becomes too CPU intensive. This question is mainly targeted towards BC_Programmer because of his BaseBlock game that I'm pretty sure also uses GDI+. So my questions are: How are the classes laid out? How do you update the OnPaint event? Is it double buffered? How do you make the GDI+ more efficient? Do you have a new class for each different type of object? BASeBlock runs game logic on a separate thread, This separate thread runs the gameproc() routine, (which is ridiculously gigantic). Essentially, the thread constantly repeats, and basically does: 1. Update all Game Objects 2. force the display to refresh The second step is performed with something like this: Code: [Select]PicGame.INVOKE((MethodInvoker)(() => { PicGame.Invalidate(); PicGame.Update(); })); Since the GameProc() routine is running on a separate thread, it cannot access UI Controls without causing an exception. The code uses Invoke on a UI control (in this case PicGame) to run a piece of code on the UI thread itself. This logic invalidates the picturebox and updates it, which results in the Paint Event of the Picturebox being fired. The Paint event is more complex, because for performance REASONS Blocks that don't need to be redrawn aren't. The result is that there is a buffer for the background, one for blocks, and one for animated blocks. the block bitmap is only changed if a block has changed. Since most blocks are static and don't move or change very often, this is a rather big improvement speed-wise. The GameProc thread sleeps for a set period of time every iteration, which is calculated based on how fast the FPS currently is. Sadly I forget most of the logic involved. It's not much different from the core idea behind the GDI+ Particle "tutorial" I posted to youtube. BASeBlock's source, though not 100% up to date, is available on my github. In order for the project to open,Build, you need VS2012 (not sure if it will open in express, either), as well as the BASeBlock RESOURCES installed (which are installed by the game installer in the desired location). You will also need BASS.NET and of course BASS itself for Sound support. (optionally, it also supports IrrKlang but I've not used that particular "driver' class in a long time) As for how the classes are laid out... Basically there are some base classes, Block, GameObject, cBall, and cParticle. Each Block in the game can trace it's inheritance tree to Block; for example, BrickBlock derives from TexturedBlock which derives from ImageBlock which derives from Block, EllipseBlock derives from PolygonBlock which derives from Block, etc. Each one naturally simply adds special behaviours to it's parent; ImageBlock makes a Block draw from an Image, TexturedBlock makes that Image a Texture, and BrickBlock uses Textures as well as a special destruction behaviour that spawns certain Particles/GameObjects, etc. Powerups are implemented via interfaces, and the Paddle can have a set of PaddleBehaviours Applied to it. Over time I've added a lot of utility methods and classes to make certain things easier. For your current implementation, I would probably make a few changes. The first would be to move your startup code into the Load Event handler for the form; the second would be to change the Game object to not accept a Form, but instead an implementation of an interface that your Form can implement. In BASeBlock, I used a interface called "iGameClient", which is implemented by the Form. The purpose of this is to provide the capability for changing what implements the interface, and prevent strong coupling with the Form itself. One of the issues originally was preventing cross-thread calls, and most importantly preventing blocks from being removed while the collection was being enumerated, since that would throw an exception. Originally I had a very gross hack that basically passed by reference lists of objects to remove, but I changed that to allow for a collection of delegates to be called before the next frame "tick" occurs. Removing blocks, balls, GameObjects/etc are usually done within the logic for them, but now they defer actual removal until the beginning of the next frame's logic. Also because I was using multiple threads, I had the paint routine working with the game's objects and the "tick" routine as well, so I had to perform some locking to prevent the game "updates" from removing or adding elements (such as in the previous delegate listing) while the painting routine was iterating over them. Slowdown: With logs of stuff on the screen, the game simply cannot necessarily process each tick as fast as would be ideal. As a result, I've implemented logic that prevents the entire game from slowing down; basically 30fps is the desired speed; if the FPS is higher than that, movement will be smoother but still travel the same distance in the same timescale. if the FPS is 15fps, then objects will move about twice as fast per frame to make up for it. There are of course some issues with this. I f ound heavy particle usage also caused performance issues so I cap the number of particles that can exist, using a Queue. Some particles are tagged as "critical" and won't be removed in this manner, but most particles are used for aesthetic purposes so most are able to be removed if this limit is reached. Anyway, the most common approach to this I've seen seems to always employ a Timer of some sort, and use the Timer event to handle each tick. But the problem is that that tick logic is occuring in the UI thread and while it operates the UI is completely blocked, so it's almost always best to keep everything that isn't drawing related outside of the UI thread. Thanks for all the info. I watched your video and looked at the diagram. I've kind of put this project on hold until I get more used to programming in C#. I have other smaller projects that I am working on now, so this has gotten pushed to the end of my list.Quote from: Linux711 on June 26, 2013, 11:28:31 PM I've kind of put this project on hold until I get more used to programming in C#. Sounds reasonable. Technically my first C# Application was a Hijackthis/DDS style tool clone. |
|
| 1105. |
Solve : Which programming language can I start with,Am a beinginer? |
|
Answer» Am jst new to programming language but which programming language should i start with.ThanksI wrote this almost a year and a half ago on the question: PHP is a server-side scripting language designed for web development but also used as a general-purpose programming language. PHP is now installed on more than 244 million websites and 2.1 million web servers.[2]PHP - From Wikipedia, the free encyclopedia However, if you do not want to do web sites, then you should study a general purpose language that is widely used and well documented and freely available. Such as PHP. This post looks like it was satisfied with BC's response... I started with Basic in the 1980s, played with Fortran, Cobol, Assembly, VB6, VC++ 5 & 6, Borland C, Perl, PHP, Python, Ruby, and liked Perl and C++ the most so 99% of everything I write is in those two. Then tried out the Visual Studio Express 2008 and 2010 and liked those a lot which also introduced me to C#. Of everything I tried out the languages Most favorite to Least favorite are: C++, Perl, C#, PHP, Python, Basic, VB, Ruby, Fortran, Cobol, and Assembly. So my top 3 languages are C++, Perl, and C# for what I need to program up. Reasons why I like these top 3: C++ - is powerful, fast at just about any task you throw at it. The cons for a new programmer are that this language is more complex than others to grasp and without someone to guide you when you get compile errors you can go crazy trying to find the problem if you dont know how to use the debugger or you forget to add a required include etc. So you need to know dependencies etc as well as there are many various ways that C++ is written DEPENDING on the programmers structure preference. I can only relate this difference in structure to that of writing in Print and Script. It says the same message written in the same language, but looks far different from each other in how its written. Perl - I use mainly for very quick down and dirty console ( DOS shell ) programming. So VS writing a C++ program that would be way more keystrokes, if I have a program that I am writing up quickly to read in and write information back to files for example, I will use Perl which is strong at this and requires far less typing. Basically the same program that Perl can achieve in say 6 lines of code, C++ could take 20 lines of code to achieve. The drawback to Perl though is that its not compiled, its executed from its source file. So if you have a program that you want to share with others and run independently without the Perl interpreter installed on each machine it runs on, you will want to write it in C++ INSTEAD. Perl is also more geared towards Server Side Execution and creating Dynamic HTML for web servers etc, even though I use it mostly for quick down and dirty programming. C# - 2008 and 2010 with Visual Studio Express I like because of that its perfect for rapid development of creating Windows Applications in a WYSIWYG and it automatically populates sections of code so you dont have to type the whole program source from scratch etc. C# replaced C++ for writing Windows Applications with GUI interface. *Many people have asked me why I didnt just go with Visual Basic for Windows Application development, and all I can say is that I just never liked VB much. I started off with VB6 and there is just something about it that I didnt like so I went the route of C++ and then C# for Windows Application development with GUI interfaced programs. Lastly, as far as books go to learn by example, which is the best for people who like to learn hands on. I would suggest getting one of the Microsoft books that comes with the DVD on the back page with Visual Studio Express 2010 or newer and source files for all projects contained in the book. I Bought these books as a guide to changes between 2008 and 2010 as well as to learn C# from by example, and it was the best $25 book I ever bought for a programming language since I learn best by example either typing the code up out of the book and compiling and troubleshooting or loading up other peoples source code and observing how they did what they did, and whenever in question, altering a section of the code with a comment tag of XXXX to find it quickly in the source etc when dealing with large programs etc. When learning Basic a long time ago on a TRS-80 Model 1 with 16k RAM, I typed in programs out of magazines from the TRS-80 Magazines, and many times either I made a typo or the magazine was printed with a typo and so it was hours of programming and troubleshooting to eventually have sprites go crazy on the MONOCHROME display etc, and usually taking programs to use and program by example and bending them to be something different using the concepts that were shared to make programs of your own such as turning a Calculator program into a Point of Sale Program etc, or a Stock Market simulation game etc introducing random generators, and then learning to seed the random number generators with a time seed etc so that the same random numbers dont occur upon future execution to where what is random is not really random, but the pattern the algorithm follows in which a die ROLL from 1 to 6 if run without a seeded timer could be 4,3,1,6 and each time the game is run without the seeded timer its always 4,3,1,6 until you add the seeded timer and then the time delay in keystroke from the user alters the output to be more random so you will get 4,1,2,6 the first time the program runs and then say 5,2,3,1 the second time it runs etc in which 4 die are rolled or a single die is rolled 4 times and the output no longer follows a predictable pattern with the seeded timer to the random generator etc. |
|
| 1106. |
Solve : Simple request for Perl programmer from an ESL teacher? |
|
Answer» I once had a word list in which the words were spelled backward (e.g., yranoitcid), but it got left on an old computer. I would love to have such a list again, so that I can do things like find a lot of examples of words that end in -ate. A word list spelled correctly but sorted from end to beginning would be equally nice. Could you do one more favor for me? I tried to do this myself, but the file is too big for Word to handle. If you could do a simple alphabetic sort on the complete list (with the sort starting from what is now the first letter), that will give me all the words with -ate together, all the words with -tion together, all the words with -ify, all the words with -ize, etc. I'm sorry I wasn't quite clear about that. Thank you. So, sort based on the reverse of the word? http://bc-programming.com/misc/sortreverse.txtBeautiful! Thank you so much! |
|
| 1107. |
Solve : C++ site tutorial? |
|
Answer» anyone who knows? http://www.cplusplus.com/ thanks men. Quote from: TheWaffle on October 18, 2012, 04:43:37 PM can you be more specific like just syntax and the standard library or a specific library and compiler? just a site where i can learn more about C++.wikipedia doesn't look like a bad place to start http://en.wikipedia.org/wiki/C%2B%2B |
|
| 1108. |
Solve : Link google maps with MS Excel VBA? |
|
Answer» I want to make a DISTRICT map of Hoimachal Pradesh,INDIA based on excel data and FILL different colours in each district boundary according to some data range...That means i want my map to be dynamic...Can I do it using excel vba??? |
|
| 1109. |
Solve : Need advice on complicated programming.? |
|
Answer» I'm in the process of making a app that I'm attempting to try and detect Bluetooth devices, which I want this app to store data from these devices and store it on a server host, so I would need to make a program that host and RECORDS data as well, also I would like to have a website that can share information to the app, for instance you could go to the forums from the app other than having going to the website. So essentially I need to know what programs I need and what program languages I need to use for the app, and program. Also if anyone knows how to get all these communicating please share.Thats a large project. |
|
| 1110. |
Solve : How do i open a Data Base File (.db) SQLite format 3 ? | C# ?? |
|
Answer» I was wondering how I can OPEN a Data Base File (.db) if POSSIBLE COULD it be opened with c# ? Cube world uses SQLite but it uses it in an immensely stupid way which includes storing binary data in the various table fields.Indeed this is cube world I don't have any coding skill with sql so I there any way I can edit this file ? |
|
| 1111. |
Solve : LNK2019 error - a vague question...? |
|
Answer» OK, the scenario… |
|
| 1112. |
Solve : hey anyone good with vbscript / c++ that could help me through with a lab? |
|
Answer» Question stated above, I use aim / msn or skypeGenerally we don't HELP with homework, but if we can ANSWER the question, hey, you never KNOW. |
|
| 1113. |
Solve : Help with Excel Formula? |
|
Answer» Hi. I am trying to create a spreadsheet to calculate compensation. Since there are 5 different possible payouts I have been trying to combine the "IF","AND" and "OR" funcitions. My forumula looks like below, except I need to add 3 more layers and it is not working. I also provided a key for reference. Which payout do the boundary values get? (i.e. 60% 80% 100%) Are they the lower or higher? e.g. do 50% to 59% get $20 and 60% to 89% get $30 and 90% to 99% get $40 and 100% plus get $50? Yes that is correct. Anything over 50% but less than 60% gets $20 per sale. Anything between 60-89% is $30 per sale. 90-99% gets $40. 100%+ of the goals get you $50 per sale.So, starting at 50% there is a minimum of $20, with $10 steps at 60%, 90% and 100% Expressions such as A2>=50 evaluate to TRUE (1) or FALSE (0). Thus we can calculate the dollars per sale. I not sure how to post my spreadsheet into the forum like you did, but i have attached an IMAGE of my spreadsheet. Hopefully you can see it. Attachment removed at request of posterK6 through K9 are the formula's I am using to calculate payout. I basically want to combine all of them into 1 cell so that I only have to enter in the number of sales and it will automatically calculate the payout. K6 =IF(AND(J6>=C6,J6K7 =IF(AND(J6>=C7,J6K8 =IF(AND(J6>=C8,J6K9 =IF(J6>=C9,J4*D9)Non-commercial use? This is just so that I can calculate my monthly income. The terms and numbers have been changed. |
|
| 1114. |
Solve : Using Windows API? |
|
Answer» Hello everyone, also if there are some good and illustrative web links or books regarding my question above, please do post it. http://msdn.microsoft.com/en-us/library/windows/desktop/hh447209%28v=vs.85%29.aspxcan an1 help me with simple sample program in c(not using gui mainly but any other api function that can be implemented without gui) so i can see its output console based or anything thank youQuote from: HardwareTwitch on October 13, 2012, 12:51:43 AM can an1 help me with simple sample program in c(not using gui mainly but any other api function that can be implemented without gui) so i can see its output console based or anything Code: [SELECT] #include "stdafx.h" #include <windows.h> #include <VdmDbg.h> BOOL WINAPI ProcessVDMs( DWORD, DWORD, LPARAM ); BOOL WINAPI ProcessTasks( DWORD, WORD, WORD, PSZ, PSZ, LPARAM ); #pragma comment( lib, "vdmdbg.lib" ) void main() { // Enumerate VDMs VDMEnumProcessWOW( (PROCESSENUMPROC)ProcessVDMs, (LPARAM)NULL ); } BOOL WINAPI ProcessVDMs( DWORD dwProcessId, DWORD dwAttrib, LPARAM t ) { printf("VDM Process ID: %d\n", dwProcessId); // Use process ID of VDM to enumerate through its tasks VDMEnumTaskWOWEx( dwProcessId, (TASKENUMPROCEX)ProcessTasks, (LPARAM)NULL ); // Keep enumerating return FALSE; } BOOL WINAPI ProcessTasks( DWORD dwThreadId, WORD hMod16, WORD hTask16, PSZ pszModName, PSZ pszFileName, LPARAM lParam ) { // Print task's information printf("ThreadID: %d\n", dwThreadId); printf("Module: %d\n", hMod16); printf("Task: %d\n", hTask16); printf("ModName: %s\n", pszModName); printf("File: %s\n", pszFileName); // Keep enumerating return FALSE; } Source and Binary graciously provided by the handsome fellow that runs this site. I think you might be tripping over standard HEADER file stuff; the Windows API for C is not USED much differently than other APIs, you include the header file (#include ) and then you call functions to interact with the Windows OS.Quote from: BC_Programmer on October 13, 2012, 03:57:01 AM Code: [Select] thank you very much and 1 more question.. the microsoft link you gave me in above have those functions which you provided in the example? |
|
| 1115. |
Solve : Learning PHP? |
|
Answer» After watching the lynda.com videos on html/css I've downloaded 100 html/css templates and am getting more flexibility and power from looking at how other people did it than the lynda.com tutorials that I found quite basic. Where can I find PHP source or what strategies should I use to try and learn PHP |
|
| 1116. |
Solve : Question for an older friend of mine that I couldnt find answer to? |
|
Answer» Co-worker was TALKING with me about computing 30 years AGO, and I was talking about the DAYS when I was using my TRS-80 in the 1980s and programming in Basic with cassette load/saves etc. He said that he really MISSES programming in Basic with line numbers and asked me if Basic advanced but to still include support for Basic with line number programming. I told him that I programmed in GW-Basic and QBasic and that the last one to support programming in Basic with line numbers was QBasic. QBasic wasn't really meant to be the old line number format but it was backwards compatible to run older format programming in Basic, but I dont believe line numbers continued to be supported from then on. I told him that OOP did away with need for line numbers as well as GOTO's and GOSUB's...LOL and everything these days is more like C. I told him that if he wants I could get him GW-Basic or QBasic off of Microsofts website, but he was wondering if there was any newer interpreter for Basic with Line Numbers to where it may have support for more modern functionality like windows etc vs being stuck in 1980's STYLE ascii and pixel blocks. I told him that I would check, but I believe the world moved on away from Line Number Basic programming in the late 1980s and early 90's when QBasic came out. I also said that it would be lacking many features like .Net etc if there was a modern interpreter. 99.999% of the world of programmers moved on to more modern languages and that there are only a few that have a desire to program in the older languages that are out of date. And that those who still program Basic with Line Numbers either use GW-Basic or QBasic. Told him I'd post the question here and get back to him. I didnt find anything on google as for I believe there is very little demand for a modernized Basic with Line Numbers interpreter/compiler.Off the top of my head, I can think of two BASICs that are more modern than GW-BASIC or QBASIC and support line numbers |
|
| 1117. |
Solve : Neural Network C++? |
|
Answer» The following code for a neural network, for some infuriating reason, outputs 50 if I use any number above two. Is this just my computer, or my code? layers->neurons_length = 50;Well, that's the section where I chose arbitrary values just to test it. For some reason, it works perfectly with small numbers of neurons, but not with larger ones.I found it. The limits of double (and long double) cause the sigmoid FUNCTION to output 1 for large inputs, which occurs in the run function when all the inputs from previous neurons are summed and run through. Thanks, anyway. |
|
| 1118. |
Solve : Check for missing attribute in xml node element? |
|
Answer» Greetings all. I have just had a need to WORK with a small xml file in a vbscript program, and after a bit of head scratching I was able to do what I needed to do. However, I am wondering if there is a better way. The xml file has only one node, with four elements, three of which have an attribute called "default". I need to load the node text and the default attribute in a 2d array for later processing. I should note, that I am not even sure if I am using the correct terminology with "node", "element", and "attribute". I am hoping that someone will be able to look at the xml file, and maybe point out some areas of improvement. As I said, the objective is to load the array, *exactly* as it is being loaded, but maybe without relying on "On Error Resume Next". Thanks for any advice or tips. |
|
| 1119. |
Solve : C++ Question regarding MFC? |
|
Answer» I have a program that is written using Standard Windows Libraries (an old VC++ 6 project converted to VS2010). |
|
| 1120. |
Solve : need help with visual basic/studio please? |
|
Answer» I don't really KNOW the best way of explaining my situation but i'll try my best. |
|
| 1122. |
Solve : examresult? |
|
Answer» Hi all.. $row1 = mysql_num_rows($sql1);Placing comment in our code can help both others and yourself. Six months from now you might forget what it means. In particular, what is $sql1 -Is it a string or a scalar or a Boolean? Something else? You do not use mysql_connect() to connect to a database, so mysql_query() returns false, and that result get's passed into mysql_num_rows which expects a resource rather than a boolean and you get the error you are receiving. Quote from: Geek-9pm on July 24, 2013, 09:18:33 PM But, I thin k yhou ought to make some comments about whkat the following line means.It's common in the older PHP database functions. the variable is created as the result from mysql_query. This is normally a loosely typed value that is only used as a 'cookie' for other functions, such as mysql_num_rows. In this case mysql_query() is returning FALSE to INDICATE failure because the code hasn't opened a database connection.What should I do now to make the code to work?You need to call mysql_connect() before you start working with the database to connect to the database server. Documentation on this function can be found here: http://php.net/manual/en/function.mysql-connect.php This function is deprecated so while it will work fine for now, if you plan on building any large applications you should look into using MySQLi as detailed here: http://www.php.net/manual/en/book.mysqli.php You should ALSO get into the habit of escaping any user provided values (e.g. $_GET, $_POST) before adding them into your queries, otherwise you are WIDE open for SQL InjectionThank you sir, But I dono exactly how to modify the line. Can anyone please modify and give me that line?Quote from: Geek-9pm on July 24, 2013, 07:33:42 PM Is this homework? I'm thinking the answer to this question is "yes".Dear All Repliers, I am basically from Electrical Engineering Background. I have interest in webdesigning, so I am learning this,. , Who from Electrical Engineering Gives Web designing as a homework? Quote from: gowthamprabhus on July 27, 2013, 07:10:01 PM Dear All Repliers,I am basically Santa Claus, I have an interesting in Programming and IT, so I often assist in a volunteer fashion on this forum. Who from the North Pole gives MySQL advice? Point being, you didn't negate anything that was claimed. You can make any number of wild claims. Replace "Electrical Engineering" with "Oval Office" and you see the problem. Even so, it's quite possible to verify what you are saying, rudimentarily, through a Google search. However, from what I found, you already claim to know PHP, and I find it difficult to imagine a case where somebody could "know" PHP but not know how to use mysql. We have already provided you the means to help yourself. If you want somebody else to write the code for you, you should hire somebody else to do so; otherwise, you will have to invest in learning what you are doing. You cannot "hire" volunteers and ask for one line of code at a time. You need to connect to the database. Look up what you are learning and using. Learn how it works. learn WHY you need to use db_connect(), and how you would do so. Otherwise, me, or anybody else telling you what line to write wouldn't help you, because you won't know what you need it. (And I don't know where you database server is, whether it's localhost, how your webhost has it configured, what the database name is, or any of those things, which would be needed to create the appropriate db_connect() call.) If this is for a Freelance project I worry for the client.Thank you for your Reply @ B C Programmer |
|
| 1123. |
Solve : VBS Pause/Resume music WMPlayer.OCX? |
|
Answer» hey, I know how to play music in VBS like so: You want two scripts to control the same object instance (WMP)? I think you would have to create an out-of-process COM object. Don't know if this would work, but it sure sounds promising.what I'm doing is programming MS-DOS Batch and occasionally using vbs files to do things batch can't so the second option isn't going to work, I'm not very familiar with vbs and don't know what an out of process COM object is, its rather hard to get batch to communicate with the vbs maybe an option would be to create a text DOCUMENT with the value of the time the music was at then kill the process and then RESTART the process later with the music starting at that point in timeI don't think this is going to happen. Giving focus to Win7 WMP from an external script for some reason does not work. I could only give focus from within the script that launched WMP. That would eliminate having seperate scripts for pause and resume. The Script Component also fizzled out. I could get the music to play but could not pause/resume it. The WMP object and the script run asynchronous, which explains the while/wend loop in your script and the sleep in my script. VBScript is single threaded, so interrupting the loop might not be possible. My suggestion is to manually start the music, and use CTL-P to toggle between pause and resume. Make sure the WMP window has focus when using CTL-P. To add insult to injury, I found that giving focus to WMP on WinXP works just fine. alright thanks for trying though |
|
| 1124. |
Solve : SQL Query for Previous Month? |
|
Answer» I have come up with the following query which gives me a summary of my help desk for the previous MONTH. The only issue that I run into is when January rolls around the it will be looking for the month which will end up as 0 and the YEAR will be 2013. It should be looking for 12/2012. This is my first attempt at SQL scripts and I'm not sure if conditional statements are possible in SQL. I don't want to have to worry about changing the code every January. Any help would be appreciated. |
|
| 1125. |
Solve : [HELP] VB.net with batch commandy? |
|
Answer» Here is my VB.Net code : |
|
| 1126. |
Solve : how to use GREP command to group lines? |
|
Answer» What I have is a folder full of Protein Database FILES (.pdb) that are code in the following pattern: |
|
| 1127. |
Solve : Programming with python? |
|
Answer» Hi I am STUDING python programming language does anyone KNOW of a WEBSITE that will explain python language in simple terms ?The official python tutorial is a good place to start. Keep in MIND that 'simple' can become 'complicated' pretty quickly with programming languages. |
|
| 1128. |
Solve : [Help] String/plain text to byte array? |
|
Answer» Im trying to convert a STRING/plain text from a textbox to a byte array. |
|
| 1129. |
Solve : Best way to achieve this?? |
|
Answer» So every week I have a schedule of employees. Every week I have to manually assign employees to machines and print out a projection of the weeks machine coverage as well as use this as a checklist when manually assigning work to employees on worksheets. This has up until now been a very manual process involving dumb excel spreadsheets requiring redundant data entry and using a web interface to assign and print daily employee worksheets. Hmm ... Never played with VBA macros before but if thats the best direction to go I should dive into it if its going to make this far easier than creating every combination of scheduling to create every output desired. I'm not 100% sure how you'd go about it, but it should be better than the alternative. Alt-F11 opens it. You can add a new module and create a Public Sub (eg. "Public Sub AssignWorkers()") then use VBA code to work with the ActiveSheet, add items to cells, etc. Then you would run the macro by that name in the Macros dialog. When I first started reading your post it sounded like a program I wrote for a freelance client a few months ago was exactly what you needed, but when I read the details it doesn't seem like it. I thought I'd mention it here anyway; It's designed to manage the time spent by employees on "Orders" (in my client's case, this was automotive repair, but it would work just as well for PC repair and stuff too); Employees clock into orders (repair orders, that is), do the work, and then clock out. This is useful for both payroll as well as for- (where applicable) charging for the labour cost of the repair. Not relevant to this particular problem but seems tangentially related and I've not done anything with the program in ages so thought I'd throw that out there too.Yah the cooperative food store chain that I use to be head of IT for had a service center and I supported their NapaTracks and Mitchel Ondemand ( web based subscription service for technical INFO ). NapaTracks allowed for customer database with tracking tech times etc, and inventory control. I also had to support their NHOST http://www.nhinspect.com/whatToExpect.html although the state contractor who had 1 to 2 day ETA on repair of this system didnt like when I got involved and fixed the problems on a kiosked OS which i hacked once to add printer drivers for a HP printer vs the Canon that failed. When you have a list of cars needing inspection and a printer fails and inspection could not be performed without printing documentation if your a crafty IT individual like myself you come up with a quick solution to make something work. I was able to hack in with a custom AUTORUN CD that triggered control.exe to bring up control panel which gave me access to installing the printer driver. The kiosk was made with stripped down interface profile, but fortunately it appeared that they left it as admin privileges vs user so I was able to install the drivers with no problems Will give VBA macro a try tomorrow when i am getting paid for my time working on this As for now time to relax and game |
|
| 1130. |
Solve : VB.Net - How to GET file name without opening it using OpenFileDialog?? |
|
Answer» I try to get a file name using OpenFileDialog |
|
| 1131. |
Solve : [Question] How do I send a packet using visual studio? |
|
Answer» So I am making a program using Visual Basic also known as Visual Studio now. My question is how do I send a PACKET from my program to a game. An example of one packet I would like to send is this. QUOTE %xt%zm%tryQuestComplete%122869%2171%-1%false%wvz%That packet I want to send by just the click of a button. The program is simple really since the game is a flash. Can you give me any HELP on finding the game's SERVER and how to send a packet to it. Some help would be greatly appreciated. No. Neither I or anyone else can know the address since you didn't give it to us. If your program is so simple (since the the game is developed in flash?? huh) why can't you consult the API? If you are trying to cheat, at least do the things required yourself.In Visual Studio one uses MS Silver light to work with video presentations. However, there is material from Adobe for doing C# INTERFACING with Flash. Hoverer, sending packet to a server may be much more than you anticipate. Without more specific information, it is hard to answer your question. |
|
| 1132. |
Solve : [Help] C# delete file unauthorized access exception? |
|
Answer» Im trying to make an updater for my application but I keep getting exceptions when trying to delete the file or download the new file. You aren't passing a URI to the DownloadFile method, it's an empty string.Yeah I know, I removed my DROPBOX link. It just points to a direct download of my application.Two things: Process.CloseMainWindow and Process.Kill is asynchronous. You would need to call .WaitForExit() if you don't want your code flow to proceed until the Application actually exits. However, Close() is for closing the handles itself; after the Close() call the Process instance is no longer valid, since the resources used locally for handling process information were cleaned up, so the Kill() call doesn't do anything. You probably shouldn't be using Kill anyway. CloseMainWindow() and then wait for it to exit should work. Quote from: BC_Programmer on July 07, 2013, 12:14:57 PM Two things:I finally had the time to fix this, thanks. |
|
| 1133. |
Solve : Building an efficent sql text search method.? |
|
Answer» I have a table with about 15000 records. * Results Page 1: "LIMIT 0, 30"And so on... So what would be a proper and efficient way to do this?Quote I need an efficient method of searching using the user input from e.g. a php textbox in "columnX" where "ocweeg" would actually match "procweegrs" You can use the LIKE CLAUSE and wildcards. This might help. Quote Also the number of records that match needs some limits The LIMIT clause is vendor specific and not a standard SQL clause. What database are you using? Quote from: Sidewinder on August 24, 2012, 02:50:48 PM You can use the LIKE clause and wildcards. This might help. I'm using InnoDB. And i will take a look at that tomorrowAfter some trial and error i came up with something that should have worked; Code: [Select]SELECT * FROM `objects` WHERE 'Model' LIKE '%plant%' OR 'Name' LIKE '%plant%' OR 'Comment' LIKE '%plant%' OR 'Category' LIKE '%plant%' OR 'MTA' LIKE '%plant%' OR 'IDE' LIKE '%plant%' LIMIT 0 , 21 Unfortunately i get this response: Quote MySQL returned an empty result set (i.e. zero rows). ( Query took 0.0004 sec )APPARENTLY the message indicates the SQL is fine, you simply did not select any records. Have you tried limiting the scope of the SQL? Something like this: Code: [Select]SELECT * FROM `objects` WHERE 'Model' LIKE '%plant%' LIMIT 0 , 21 Showing us some of the OBJECTS table might also help. Question: why the back ticks wrapping the table name? Sorry Sidewinder, but it all works now This is the new syntax: Code: [Select]SELECT * FROM objects WHERE Model LIKE '%plant%' OR Name LIKE '%plant%' OR Comment LIKE '%plant%' OR Category LIKE '%plant%' OR MTA LIKE '%plant%' OR IDE LIKE '%plant%' LIMIT 0 , 21 I don't know why but apparently MySQL did not like that i encased field names or the table name. |
|
| 1134. |
Solve : Finding the cell of a column which is located in a row defined by two values? |
|
Answer» This a typical sample: |
|
| 1135. |
Solve : PHP -Contact Form error? |
|
Answer» I need help on "CONTACT Form", when I click submit, I am prompted to download the form, instead of SENDING it, what could be causing this error? * Are you human? 3 + 1 = The PHP code is: if(!$_POST) exit; // Email address verification, do not edit. function isEmail($email) { return(preg_match("/^[-_.[:alnum:]][emailprotected]((([[:alnum:]]|[[:alnum:]][[:alnum:]-]*[[:alnum:]])\.) +(ad|ae|aero|af|ag|ai|al|am|an|ao|aq|ar|arpa|as|at|au|aw|az|ba|bb|bd|be|bf|bg|bh|bi|biz|bj|bm|bn|bo |br|bs|bt|bv|bw|by|bz|ca|cc|cd|cf|cg|ch|ci|ck|cl|cm|cn|co|com|coop|cr|cs|cu|cv|cx|cy|cz|de|dj|dk|dm |do|dz|ec|edu|ee|eg|eh|er|es|et|eu|fi|fj|fk|fm|fo|fr|ga|gb|gd|ge|gf|gh|gi|gl|gm|gn|gov|gp|gq|gr|gs |gt|gu|gw|gy|hk|hm|hn|hr|ht|hu|id|ie|il|in|info|int|io|iq|ir|is|it|jm|jo|jp|ke|kg|kh|ki|km|kn|kp| kr|kw|ky|kz|la|lb|lc|li|lk|lr|ls|lt|lu|lv|ly|ma|mc|md|mg|mh|mil|mk|ml|mm|mn|mo|mp|mq|mr|ms|mt|mu |museum|mv|mw|mx|my|mz|na|name|nc|ne|net|nf|ng|ni|nl|no|np|nr|nt|nu|nz|om|org|pa|pe|pf|pg|ph|pk |pl|pm|pn|pr|pro|ps|pt|pw|py|qa|re|ro|ru|rw|sa|sb|sc|sd|se|sg|sh|si|sj|sk|sl|sm|sn|so|sr|st|su |sv|sy|sz|tc|td|tf|tg|th|tj|tk|tm|tn|to|tp|tr|tt|tv|tw|tz|ua|ug|uk|um|us|uy|uz|va|vc|ve|vg|vi |vn|vu|wf|ws|ye|yt|yu|za|zm|zw)$|(([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5])\.){3} ([0-9][0-9]?|[0-1][0-9][0-9]|[2][0-4][0-9]|[2][5][0-5]))$/i",$email)); } if (!defined("PHP_EOL")) define("PHP_EOL", "\r\n"); $name = $_POST['name']; $email = $_POST['email']; $subject = $_POST['subject']; $comments = $_POST['comments']; $verify = $_POST['verify']; if(trim($name) == '') { echo 'Please enter your name.'; exit(); } else if(trim($email) == '') { echo ' Please enter a valid email address.'; exit(); } else if(!isEmail($email)) { echo ' You have enter an invalid e-mail address, please try again.'; exit(); } if(trim($comments) == '') { echo ' Please enter your message.'; exit(); } else if(!isset($verify) || trim($verify) == '') { echo ' Please enter the verification number.'; exit(); } else if(trim($verify) != '4') { echo 'The verification number you entered is incorrect. Please enter it again'; exit(); } if(get_magic_quotes_gpc()) { $comments = stripslashes($comments); } $address = "[emailprotected]"; $e_subject = 'You\'ve been contacted by ' . $name . '.'; $e_body = "You have been contacted by $name with regards to $subject, their additional message is as follows." . PHP_EOL . PHP_EOL; $e_content = "\"$comments\"" . PHP_EOL . PHP_EOL; $e_reply = "You can contact $name VIA email, or $email"; $msg = wordwrap( $e_body . $e_content . $e_reply, 70 ); $headers = "From: $email" . PHP_EOL; $headers .= "Reply-To: $email" . PHP_EOL; $headers .= "MIME-Version: 1.0" . PHP_EOL; $headers .= "Content-type: text/plain; charset=utf-8" . PHP_EOL; $headers .= "Content-Transfer-Encoding: quoted-printable" . PHP_EOL; if(mail($address, $e_subject, $msg, $headers)) { // Email has sent successfully, echo a success page. echo ""; echo ""; echo "Email Sent Successfully."; echo " Thank you $name, your message has been submitted to us. ";echo ""; echo ""; echo ""; } else { echo 'ERROR!'; } |
|
| 1136. |
Solve : PLS HELP ON THIS!? |
|
Answer» I just bought an HP PAVILION G4-1318DX NOTEBOOK WITH D FOLLOWING SPECS,....2GB RAM,320GB HARD DISK,2.1GHz,INTEL PENTIUM WINDOWS 7 ETC,..AM A FIRST YEAR STUDENT IN D UNIVERSITY STUDYING COMPUTER ENGINEERING AND WE HAVE STARTED PROGRAMMING,PLS I WANT TO KNOW IF I CAN USE D NOTEBOOK FOR PROGRAMMING.,I ALREADY FEEL AS IF AV WASTED MONEY,..,PLS CAN I USE IT 4 PROGRAMMING?TANX 4 UR RESPONSES IN ADVANCEDepends on the programming tools you need to use, but you should probably be fine as long as you don't RUN too much other things at once. If I didn't have the 4GB of RAM that I have, I'd probably be closing Spotify, SugarSync, Skype, and similar memory HOGGING applications while I programmed. VS2010 USES upwards of 200MB of RAM, NetBeans sometimes even more.tanx so much |
|
| 1137. |
Solve : Looking for best method - Disable/Enable internet with C++? |
|
Answer» So its summer and my daughter wants to use her computer a lot, but I dont want her brain turning to mush. |
|
| 1138. |
Solve : vbs to play mp3? |
|
Answer» So I was writing a vbscript to run from command line and take the input and PLAY the corresponding mp3 file. I used some code I found online and tested it, and it worked perfect for running a set file, but when I tried to replace that part with a string, it doesn't do anything. Can anyone point out what's wrong? Thanks in ADVANCE! Also the mp3 variable is undefined and time is a reserved word. Time isn't a reserved word in VBScript. It's a reserved word in Visual Basic. That said, their script still doesn't make SENSE. First it starts using OLE Automation and then it uses shell. it uses a variable that has no value (mp3), too (as you noted) Either way, absolutely none of the provided ProgIDs works for me :/ They all throw a "ActiveX Component cannot create Object" Error in both VBScript as well as in VB6. |
|
| 1139. |
Solve : Script for adding a printer? |
|
Answer» Hey i need a pro to help me program a script that will run and add a printer to out network |
|
| 1140. |
Solve : Net Objects Fusion PDF question? |
|
Answer» I am using Net OBJECTS FUSION and I wish to know of a way to have a PDF VIEWABLE, but not downloadable? |
|
| 1141. |
Solve : Favorite programming language?? |
|
Answer» MFC C++Pythonc++ and xml (although xml is not technically a programming language, before anyone else points it out!)C++ Definitely. Better for hardcore low level programming The topic is: Favorite programming language?One could have a favorite without finding what is better. There is always better and the is always favorite. Bit they may not be the same. For myself, ushering C++ for low-level programming would e the worst thing ever for me personally. I was a seasoned commercial assembly language programmer and would find the structure of C++ to be stifling. But if C++ goes on to become the favorite and the best, it will not be because of any work I ever did. Intel at one time, long, long AGO, had a PL/M compiler. Now Intel favors C++ for its current products. The PL/M was rather good, but it lost popularity for reasons that are hard to understand.This could lead one to the idea that someday C++ will be considered just too old-fashioned for the new machines yet to appear. If I live forever I will become one of the few who remember what assembly language is was. Assembly is still the only true low-level language. C++ is hardly low-level; when companies write a game in C++, they use OpenGL and DIRECTX and Boost and who knows what other libraries. They don't write their own 3-D rendering code that directly programs VGA registers to switch to the undocumented higher resolution 256 color modes, and they certainly don't directly program video card registers for the myriad of available architectures. With DOS, this was the standard- that is, it was more low level. if you wanted to deal with video, you grabbed a book like Michael Abrash's "Graphics Programming Black book" and learned how to directly program the VGA registers and got to understand how the four bit planes were used. Back then even drawing a Line would require you learn a rather sophisticated algorithm (Bresenham was the standard). The change was more because of the switch over to protected mode Operating Systems, and with the increasing networking, it just didn't make sense to trust a program to deal with absolutely every detail of the system. Besides, it got pretty silly, what with all the different programs needing their own special drivers for different graphics cards. Now you essentially say "hey, OS, draw a line from here to here, and use this pen information" and the OS delegates that to the driver, which does it. THe driver is low level- they are usually programmed in Assembly or at least C, and they implement things like the Bresenham algorithm with line-balancing as well as a myriad of other things. A C++ program draws a circle with OpenGL something like this: Code: [Select]void Circle( Float x, Float y, Float r) { glBegin( GL_TRIANGLE_FAN ); glVertex2f( x, y ); for( Float i = 0; i <= 2 * PI + 0.1; i += 0.1 ) { glVertex2f( x + sin( i ) * r, y + COS( i ) * r ); } glEnd(); } The equivalent code in Java: Code: [Select]void Circle( Float x, Float y, Float r) { int NUM_ITERATIONS=64; GL11.glPushMatrix(); GL11.glTranslatef(x, y, 0); GL11.glScalef(radius, radius, 1); GL11.glBegin(GL11.GL_TRIANGLE_FAN); GL11.glVertex2f(0, 0); for(int i = 0; i <= NUM_ITERATIONS; i++){ double angle = Math.PI * 2 * i / NUM_ITERATIONS; GL11.glVertex2f((float)Math.cos(angle), (float)Math.sin(angle)); } GL11.glEnd(); GL11.glPopMatrix(); } The C++ version doesn't look any "lower level" to me! Now, on the other hand, if you want to draw a line in Assembly by programming a VGA directly, that's nearly 10 pages of Assembly code. THAT is low-level; setting resetting bit mask registers, setting up pixel masks with in-byte pixel addresses, all that fun stuff. Low-level programming is now pretty much confined to embedded systems where, like the 8088, 286, 386, and other early CPUs, optimization made huge impacts on performance. Today, with multiple cores, and all sorts of different instructions, multiple instruction pipes that have rules about what instructions can go in them, as well as a myriad other issues and gotcha's related to instruction branching and pre-fetching, optimization to the level of assembly is no longer something that is a SANE practice on modern desktop machines; compilers can produce far better code, or, to be more precise, the amount of time it would take an expert assembly programmer to do better than the compiler is no longer cost effective. Back in the day it might take 2-3 times longer to re-implement a complex algorithm in assembly and then work to eliminate as many jumps and cycle eaters as possible, but the gain would often make the result at least twice as fast. Of course even then the most important thing was to use the right algorithm first; trying to squeeze speed out of bubble-sort using assembly would be pretty stupid. On any modern machine (P2 or newer) I've yet to notice any appreciable difference in speed based on what language a program is written in. Embedded systems, on the other hand, which don't have a bajillion megabytes of memory or display adapters that can push out 5 trillion triangles a second or whatever is the norm on desktops today, can and benefit from that sort of tweaking. But they don't get quite as much benefit from C++, unless you take a lot of precautions such not using new/delete, avoiding exceptions, avoiding virtual classes with inheritance (and maybe inheritance altogether) be very careful with templates (or ideally don't use them at all as they bloat the code size, which is pretty important when we're talking about 8K of RAM), etc. with Embedded systems, cycle eaters and knowing exactly what is going to run- which means knowing exactly what will be emitted for any given higher level language is critical. C is pretty easy to "mind translate" into assembly for a learned C programmer; C++ not so much. Thanks for the replay. You can understand why I am not eager to spend a lot of time on C++. When In need something above assembly, I can do it in C or a similar language. One option I have used is a Macro Assembler. The Macro assembler lets you have external files, macros and libraries and can even hide adjustments that haven to be made to the code. One programmer had a HABIT of putting macros in many different source files and making them public to other files. When he left, two of use worked over his code and put all the macros into one file; We called is ''BigMac'. Having huge macro definitions does not blot the output code. You might have a macro for a circle with center point x-y, diameter, thickness and optional color. The invocation might be: circle 24. 385, small , fine, blue (first two numbers are the absolute co-ordinates.) and it would call a procedure that would do all that, but the print out of the program list would hide it from you. But you had to first create the macro yourself. Once you had it in a file, other programmers could use it. Programmers in a project would have to make a in-house handbook of what macros definitions are available. But, as you say, now there is so much more to worry about. With networking, you have to have permissions all that stuff. Yes, embedded systems are taking over. I once make a joke about my household garbage can having two IP addresses. Maybe it will someday not be an joke. I have used other languages including C++, Java and various dialects of BASIC, but the fact is that C is the best programming language of all time.Quote from: JohnChapman on July 12, 2012, 07:56:36 AM I have used other languages including C++, Java and various dialects of BASIC, but the fact is that C is the best programming language of all time.ALL Time? No, it is not. There was a time C was not available for a PC. And when it did become available, it was terrible. I was writing communications programs for PCs back in the late 80s. Then C was no help and was overpriced and under performing. I wrote routines in assembler. Of course my earlier training was in assembler and PL/M. C++ |
|
| 1142. |
Solve : php help? |
|
Answer» $Fname = $_POST["Fname"]; |
|
| 1143. |
Solve : How can I remove an ugly image in an EXE file?? |
|
Answer» Thee is a free ISO burner PROGRAM I like to use. But I don't like the ugly little image that looks like a DEMON child. Can I remove / replace r it? Thee is a free ISO burner program I like to use. But I don't like the ugly little image that looks like a demon child. Can I remove / replace r it? It depends entirely on how the image was added to the program. usually you can. With Resource hacker, you should be ABLE to find the bitmap in the resources. If so, you can safely replace it. I've used Resource Hacker to hack dialogs in a few applications. for example, I found Visual Basic 6's References and Components dialogs to be annoying small. So I opened VB6.EXE in resource hacker and simply made them larger. I also added a Common Controls manifest so it would use Visual Styles. Again THOUGH, this depends entirely on how the Application was written. I could be more specific if you provide the Application Name.Wow, you did that to VB6! ISO Image Burner 1.1 is the file I want to change. It is on softpedia and other places. http://www.softpedia.com/get/CD-DVD-Tools/Data-CD-DVD-Burning/ISO-Image-Burner.shtml Below are the child I don't want. And the bird I do want. [recovering disk space, attachment deleted by admin]It's written in Delphi. it doesn't look like it has the image as a resource, so you cannot remove it that way. However, opening it in resource hacker, it does jave a RCDATA\TIMAGEFORM resource. That has a entry that appears to set a picture. It is however a set of HEX digits, so if you want your image you'd probably need to replace it with the appropriate Hex for it. I did so and it no longer has the image. Thank you BC. I will enjoy planning with it. Quote from: Geek-9pm on August 23, 2013, 10:58:16 PM Thank you BC. I will enjoy planning with it. You can't miss the entry- it takes up about 99% of the resource. |
|
| 1144. |
Solve : Run .exe (made from python script) without cmd? |
|
Answer» Hi all, |
|
| 1145. |
Solve : Visual Basic Codes? |
|
Answer» i need help finding the codes to MAKE these questions work on visual basic if i do find some codes Don't "find" them, write them yourself. Have you had any programming lessons? Have you got any course material? have you studied it? what the heck is a "For- Next Sentence"? HERE is one answer. Oh you wanted Visual Basic? Oh darn. I'm actually better with VB then python but this will make things far more frustrating until you actually do the work yourself. 1. I ignored the "insert" thing and pretended it meant input. Code: [Select]#!/usr/bin/env python import math inputresult = raw_input("Enter Number:") inputresult = float(inputresult) print "Negative Number" if 0 > inputresult ELSE "number " + str(inputresult) + " has " + str(int(round(math.log10(inputresult),0))) + " DIGITS." Also sadly I think you are actually expected to determine the number of digits in the number by just looking at the length of a string. I was going to do the other ones but I lost interest. |
|
| 1146. |
Solve : Java problem? |
|
Answer» Guys i have an assignment that i don't know how to do it so help me PLEASE !! nothing !! I'm pretty sure the instructor is supposed to be grading YOUR work, not SOMEBODY else's work. I personally have no problem helping people who at least try. You didn't even do that.How much will pay for it ? |
|
| 1147. |
Solve : Beginners C# question... Using Try Catch exceptions to detect non numeric inputs? |
|
Answer» I'm doing a project for my CS116 where the program has to generate an error message in a label when a user inputs a non numeric character in a text box and then presses a button. I've spent hours googling this on top of using my textbook and I just can't figure it out. I would do SOMETHING like |
|
| 1148. |
Solve : Plz help c++ Plz Plz? |
|
Answer» include then i get something e+xxxxx(x= number)the output is correct. It is in scientific notation.Yes its the correct output however if you want a long long number vs scientific notation, you could take a number like 284,000,000,000,000,000,000 and divide it to use the 284 and concatonate your 0's on the tail of the output. such as Code: [Select]int After_Division; cout<<After_Division<<",000,000,000,000,000,000\n";to get 284,000,000,000,000,000,000 You can use your existing output from ages below and include that in every cout<Quote aget=agem*30*24;Code: [Select]double someval=40E120; cout<<fixed<<someval<<endl; BC can you explain double someval=40E120; cout< I dont see any scale to this concationation of an INT and DOUBLE for each ms, ns, ps etc? Also aget=agem*30*24; ages=aget*60; agemils=aget*60*1000; agemics=agemils*1000; agens=agemics*1000; ageps=agens*1000; agefs=ageps*1000; is easier to follow if you change agemils=aget*60*1000; to agemils=ages*1000; and the calculation is partially redundant to the prior formula above it. It looks much cleaner as below even though you will end up with same output. aget=agem*30*24; ages=aget*60; agemils=ages*1000; agemics=agemils*1000; agens=agemics*1000; ageps=agens*1000; agefs=ageps*1000; Quote from: DaveLembke on August 16, 2012, 11:27:46 AM Looking at this conversion formula I think there is a typo too Code: [Select]aget=agem*30*24; ages=aget*60; agemils=aget*60*1000; if Agem starts as 12, we end up with: aget=12*30*24=8640 ages=8640*60=518400 agemils=8640*60*1000=518400000 AND; for the 'fixed' version: Code: [Select]aget=12*30*24=8640 ages=8640*60=518400 agemils=518400*1000=518400000 The results are the EXACT same. After I submitted it I realized it wasnt typo just a longer than needed formula... was editing my post then got pulled away from my lunch and came back and you beat me to the correction to my original post that I corrected. I should have eaten my lunch to increase blood sugar = better thinking, before posting that, and corrected it sooner than later...LOL Hypoglycemia is not fun Quote from: DaveLembke on August 16, 2012, 10:43:26 AM Yes its the correct output however if you want a long long number vs scientific notation, you could take a number like 284,000,000,000,000,000,000 and divide it to use the 284 and concatonate your 0's on the tail of the output. Good idea to suffix with 0'sWas looking back and noticed that you are using a goto statement. goto top; I'd wrap it all within a while loop and do away with the goto. If this is school work, which I am thinking it may be, an instructor might complain with that goto's lead to spaghetti code. Having started with GW-Basic as my first programming language with line numbers, when I referred to goto's when we were discussing loops and redirection, I was scolded with NEVER USE GOTO's its poor programming technique and spaghetti code. Maybe you haven't played with loops yet and will soon. They are lots of fun. C/C++ is one of my favorite languages and powerful. PERL is my 2nd favorite. Personally since then, I have used goto's as a quick fix at times than to nest everything within loops, but when creating programs I try to avoid them whenever possible vs making sloppy code with goto here, goto there, goto this_alternative_object, goto beginning_to_restart There's also another issue with goto: it's not usually implemented well (or at all) in other programming languages, decreasing portability. An example is TI-BASIC (Used on the TI-83/84 series of calculators), where if STATEMENTS and loops used a stack mechanism to remember the beginning of the statement until it was ended. Goto could be used to jump out of one of these structures, possibly starting another loop. Eventually, an ERR: MEMORY would come up because of how much memory was used by the stack mechanism and how many loops had piled up unended. Needless to say, that was a pretty serious problem.Quote from: TechnoGeek on August 17, 2012, 09:44:02 AM There's also another issue with goto: it's not usually implemented well (or at all) in other programming languages, decreasing portability. Its implementation in C++ can also be confusing. Especially if used within loops, in fact, although one would hope you wouldn't mix goto with loops. his111, don't feel like there's something terribly wrong with using goto in a small program like yours, it's just we try to avoid it for the reasons described and it's a PRACTICE that can quickly make programs far harder to read. I'm sure Dave identified it because you're new and it's something a new programmer should know. And I too hope you enjoy learning C++, it is a very nice language sometimes.Quote from: DaveLembke on August 16, 2012, 11:27:46 AM BC can you explaincasting from a int to a double does not result in any concatenation. Only narrowing conversions need a cast. Quote and the calculation is partially redundant to the prior formula above it.There is no redundancy. Any compiler worth using will optimize the operations at compile time anyway. Quote It looks much cleaner as below even though you will end up with same output.This is true. |
|
| 1149. |
Solve : WinAPI Using starting console? |
|
Answer» How does one detect and attach itself to the console window it was started from (if it was started from a console window)?You don't, at least not as I understand it. |
|
| 1150. |
Solve : Need Help With Vb 2010? |
|
Answer» I Want A Text box To Display: $0.00. Which it gets from a website. |
|