

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.
1. |
Solve : Utility to modify CSV text file ?? |
Answer» Paste this code into Notepad and save it to a folder (any folder, including the desktop) with a name of your choice and the extension ".vbs" "Import failed because the file does not have delimited first line" Whoops! I THOUGHT I was "tidying up" by eliminating the final trailing comma... that I assumed was a mistake... I shall reinstate it forthwith (quick edit!): It is now present both in the header line and the following data line(s) (as per the originals) Hope this works... off to bed now... been watching "Sherlock" (Benedict Cumberbatch brilliant!)... will check tomorrow to see if it worked... Code: [Select]Const ForReading = 1 Const ForWriting = 2 Set objFSO = CreateObject("Scripting.FileSystemObject") Set ReadFile = objFSO.OpenTextFile (wscript.arguments(0), ForReading) Set objFile = objFSO.GetFile(wscript.arguments(0)) wscript.echo "Ready to create file: "& VBCRLF & objFile.ParentFolder & "\Download.csv" Set Writefile = objFSO.CreateTextFile (objFile.ParentFolder & "\Download.csv", ForWriting) ' Read input file all at once strText = ReadFile.ReadAll Readfile.Close ' Split input file into lines and store in array arrFileLines = Split(strText, vbCrLf) ' Process first (headers) Line StrHeaderLine = arrFileLines(0) arrHeaderFields = Split(StrHeaderline, ",", -1, 1) strNewHeaderLine="" For k=0 To 16 strNewHeaderLine = strNewHeaderLine & arrHeaderFields(k) & "," Next 'Rem modified Header 17 strNewHeaderLine = strNewHeaderLine & " Postage and Packing" & "," For k=18 To 27 strNewHeaderLine = strNewHeaderLine & arrHeaderFields(k) & "," Next ' New Header 28 strNewHeaderLine = strNewHeaderLine & " Escrow ID" & "," ' New Header 29 strNewHeaderLine = strNewHeaderLine & " Invoice ID" & "," For k=28 To 32 strNewHeaderLine = strNewHeaderLine & arrHeaderFields(k) & "," Next ' Modified Header 33 strNewHeaderLine = strNewHeaderLine & " Address Line 2/District" & "," For k=34 To 37 strNewHeaderLine = strNewHeaderLine & arrHeaderFields(k) & "," Next ' ' AS PROMISED HEADER NOW ENDS WITH A COMMA ' strNewHeaderLine = strNewHeaderLine & arrHeaderFields(38) & "," Writefile.writeline strNewHeaderLine For j = 1 To (UBound(arrFileLines)-1) ReadLine = arrFileLines (j) arrFields = Split(Readline, Chr(34), -1, 1) OutputLine="" ' Split data lines at quote marks ' Even numbered lines starting at 0 will be commas ' odd numbered lines will be the fields ' commas in fields are OK now ' Process up To & including Invoice Number For k=1 To 63 step 2 outPutLine=OutputLine & Chr(34) & arrFields(k) & Chr(34) & "," Next ' Add the new blank fields ' Escrow ID outPutLine=OutputLine & Chr(34) & "" & Chr(34) & "," ' Invoice ID outPutLine=OutputLine & Chr(34) & "" & Chr(34) & "," ' Add all remaining fields except last For k= 65 To 75 step 2 outPutLine=OutputLine & Chr(34) & arrFields(k) & Chr(34) & "," Next ' ' Add last field *** with *** trailing comma ' outPutLine=OutputLine & Chr(34) & arrFields(77) & Chr(34) & "," Writefile.writeline outPutLine Next Writefile.Close wscript.echo "Download.csv written - processing completed" That is brilliant !! ... it worked first time I notice that if you CLICK the .vbs icon without dropping a file on it, then you get a MS script error popup, as expected. Is it possible to replace that with a Warning popup instead so if she does click it, it will remind her the icon will only work when you drop a .csv file on it ? That's a nice-to-have and not necessary so if its a lot of work then please ignore. Many thanks for your help. Quote from: nqtraderman on January 02, 2012, 02:10:42 AM I notice that if you click the .vbs icon without dropping a file on it, then you get a MS script error popup, as expected. Is it possible to replace that with a Warning popup instead so if she does click it, it will remind her the icon will only work when you drop a .csv file on it ? Updated version below. If you double click or in some other way start the script with no file supplied you get this: If you drop a file (it doesn't have to have any particular name or extension but it should conform to the format of your source.txt that you posted) you get this: Requirements for dragged file: * It must reside on a writeable medium such as a hard drive (e.g. NOT a write-protected pen drive or CD-ROM) because the utility is hardwired to create the download.csv in the same folder. * It must be a CSV file in format, the name can have spaces, and the extension can be anything you like (or absent). * It must have a header line as per your source.txt with at least the same number of fields. * It must have at least one data line, with at least the same number of fields, and they must have quotes around them. * It doesn't matter if the data fields have commas in them. Until you click OK in this dialog, any previous file called "download.csv" in the same folder as the dragged file can be renamed or moved out of the way. Once you click OK, the script will obliterate it and over write it with the new one. Click OK and the processing starts. When it is done (this should be more or less instantly) you get this Note: if the dragged file is wrong in some way, e.g. it is a csv but has the wrong number of fields or lines, or if it is a wrong type of file altogether, (a Word document or a jpg or whatever!) then you would get a standard MS error message like this at the processing stage (It would be quite complex to make a custom message for this so you will have to rely on guiding the user to only drag the right file, unless you want to enforce a definite file name policy?) Obviously, details in the MESSAGES such as the script name and the file paths are going to be different on your machine. As I SAID above, the output file name "download.csv" is hard-coded, as is the folder where it will go, (the same one as the input file) and it will permanently obliterate and replace any file called download.csv that happens to be in there already. All testing and writing has been done on Windows 7 so you should be OK if you upgrade your OS at some later date. Let me know how you get on. Code: [Select]Const ForReading = 1 Const ForWriting = 2 MsgTitle = "CSV Transformer Utility" If wscript.arguments.Count = 0 Then dummy = MsgBox("There was an error:" & vbcrlf & "You need to drop a file!" , vbOKOnly + vbCritical, MsgTitle) wscript.Quit End If Set objFSO = CreateObject("Scripting.FileSystemObject") Set ReadFile = objFSO.OpenTextFile (wscript.arguments(0), ForReading) Set objFile = objFSO.GetFile(wscript.arguments(0)) InputFileName=objFile.Path dummy = MsgBox("Input file: " & vbcrlf & InputFileName & vbcrlf & vbcrlf & "Ready to create file: "& VBCRLF & objFile.ParentFolder & "\Download.csv" , vbInformation, MsgTitle) Set Writefile = objFSO.CreateTextFile (objFile.ParentFolder & "\Download.csv", ForWriting) ' Read input file all at once strText = ReadFile.ReadAll Readfile.Close ' Split input file into lines and store in array arrFileLines = Split(strText, vbCrLf) ' Process first (headers) Line StrHeaderLine = arrFileLines(0) arrHeaderFields = Split(StrHeaderline, ",", -1, 1) strNewHeaderLine="" For k=0 To 16 strNewHeaderLine = strNewHeaderLine & arrHeaderFields(k) & "," Next 'Rem modified Header 17 strNewHeaderLine = strNewHeaderLine & " Postage and Packing" & "," For k=18 To 27 strNewHeaderLine = strNewHeaderLine & arrHeaderFields(k) & "," Next ' New Header 28 strNewHeaderLine = strNewHeaderLine & " Escrow ID" & "," ' New Header 29 strNewHeaderLine = strNewHeaderLine & " Invoice ID" & "," For k=28 To 32 strNewHeaderLine = strNewHeaderLine & arrHeaderFields(k) & "," Next ' Modified Header 33 strNewHeaderLine = strNewHeaderLine & " Address Line 2/District" & "," For k=34 To 37 strNewHeaderLine = strNewHeaderLine & arrHeaderFields(k) & "," Next ' ' AS PROMISED HEADER NOW ENDS WITH A COMMA ' strNewHeaderLine = strNewHeaderLine & arrHeaderFields(38) & "," Writefile.writeline strNewHeaderLine For j = 1 To (UBound(arrFileLines)-1) ReadLine = arrFileLines (j) arrFields = Split(Readline, Chr(34), -1, 1) OutputLine="" ' Split data lines at quote marks ' Even numbered lines starting at 0 will be commas ' odd numbered lines will be the fields ' commas in fields are OK now ' Process up To & including Invoice Number For k=1 To 63 step 2 outPutLine=OutputLine & Chr(34) & arrFields(k) & Chr(34) & "," Next ' Add the new blank fields ' Escrow ID outPutLine=OutputLine & Chr(34) & "" & Chr(34) & "," ' Invoice ID outPutLine=OutputLine & Chr(34) & "" & Chr(34) & "," ' Add all remaining fields except last For k= 65 To 75 step 2 outPutLine=OutputLine & Chr(34) & arrFields(k) & Chr(34) & "," Next ' ' Add last field *** with *** trailing comma ' outPutLine=OutputLine & Chr(34) & arrFields(77) & Chr(34) & "," Writefile.writeline outPutLine Next Writefile.Close dummy = MsgBox("Processing completed" , vbInformation, MsgTitle) That works great, thank you so much for writing this for me, it will be very useful. Most appreciated. thanks again and Happy New Year.You are very welcome - do feel free to suggest any tweaks or alterations that you feel may be useful. Seem to open myself up as a target when I say something, but have to say I am impressed with all this even if it is way over my head. |
|
2. |
Solve : *** Problem opening programs, etc. ***? |
Answer» Warez are dangerous things. Sometimes you get MUCH more than what you paid for..... You guys are right.... I usually check every file before installing but this one time, i didnt... I began to download NORTON antivirus.... All the Norton stuff showed up but when I restarted all my files were unattached or locked.... I cant even run any antivirus programs.... No Nada... I cant open a music file, picture file, etc... Sorry for the trouble guys.... I'm going to get an external harddrive put all my stuff on it and reformatt everything and see if that works... Desktop Picture...not so good, try to use system restore, if you still have an backup from the registry before the problems....BOOT to your OS disk & choose the repair option.Well Guys, nothing worked and I really haven't had time to work on it.... I suppose that my best bet is to just remove all the files from my laptop and redo the laptop... My question is what is the best way for me to remove all the files from my laptop. Which folder should I copy over....Do you have critical data on your laptop? If not, it'd be easier to just wipe the whole thing INSTEAD of trying to back it up. If there is important stuff on there, you probably want to mirror the whole drive on to the external. I'm not sure how to do that, but copying one or two folders probably won't do the trick. There's probably software on the net somewhere that'll mirror a hard drive onto another one. Just a note, I know you already know this, but I'm just clarifying: NEVER download .exe files from Limewire. I've never seen one that doesn't include spyware, adware, or actual viruses. -rock edit #1: I just found your other thread, and I'd just like to reiterate (oops, what was his name?) somebody's post: You probably should save images, contact lists, favorites, and other created files (papers, word processed documents, spreadsheets, etc.).Thanks, this is a mess.... :-/ |
|
3. |
Solve : c# sharpdevelop border style - none? |
Answer» I have a form that isnt sizable, doesnt have close, maximize or minimize. I am wanting to KNOW if there is anyway of MAKING it sizable, but not including the close, maximize and minimize ( doesnt show them at all, not just disable).You can do this either at run time or design time. Set the following form properties to FALSE: maximizebox, minimizebox and controlbox. |
|
4. |
Solve : Python - Writing Text To File?? |
Answer» How can I print something to a new FILE USING python? A great free Python Learning Book for all ages despite its title. The problem with the title being of course that the name "Python" for the language has nothing to do with the animal... |
|
5. |
Solve : Windows Product Key? |
Answer» ANYONE knows how to retrieve windows product key using vb.net? I have got a sample to retrieve Windows XP product key, but i also need to retrieve the product key for OTHERS, ie: Win 2k, Win 98... Here's the sample to retrieve WinXP product key: Public Function GetXPKey() As String Dim RegKey As RegistryKey = _ Registry.LocalMachine.OpenSubKey("Software\Microsoft\Windows NT\CurrentVersion", False) Dim bytDPID() As Byte = RegKey.GetValue("DigitalProductID") Dim bytKey(14) As Byte Array.Copy(bytDPID, 52, bytKey, 0, 15) Dim strChar As String = "BCDFGHJKMPQRTVWXY2346789" Dim strKey As String = "" For j As INTEGER = 0 To 24 Dim nCur As Short = 0 For i As Integer = 14 To 0 Step -1 nCur = CShort(nCur * 256 Xor bytKey(i)) bytKey(i) = CByte(Int(nCur / 24)) nCur = CShort(nCur Mod 24) Next strKey = strChar.Substring(nCur, 1) & strKey Next For i As Integer = 4 To 1 Step -1 strKey = strKey.Insert(i * 5, "-") Next Return strKey END Function Thanks. |
|
6. |
Solve : JB and LB? |
Answer» Has ANYONE heard of JB (Just BASIC) or LB (Liberty Basic) ?? |
|
7. |
Solve : "New" search service for computer code? |
Answer» Google << imagine that!! - has annouced a new search engine service for computer programmers. Check out article, I am SURE more articles RELATED to this will be out TODAY. I didn't read the whole article but I hope its free.... Works for me. Me too!Wow that's cool, a code search! If page won't load, try http://www.google.com/codesearchNice way to BUMP an OLD THREAD. |
|
8. |
Solve : Calculate multiple values (with the same jobNo) in an ADO recordset? |
Answer» Code: [Select]Dim div As Integer |
|
9. |
Solve : programming Clarion? |
Answer» Clarion 6 ABC. |
|
10. |
Solve : Load Of Resources Failed. Why?? |
Answer» I want to load a bitmap image in my C - program. So, I have a bitmap image - TEXT.bmp. |
|
11. |
Solve : Need help with pong program in QB64? |
Answer» Need help with pong program I made a 2d pong program; when the ball goes off the screen for the first time, it resets it back to its original position and changes the score accordingly. When it goes off the second time it gives an error code. I've already put in several 'on error goto...' statements but i cant seem to get it to work. Here is my source code: ' Set aside enough space to hold the sprite DIM ball%(30000000) ponescore = 0 ptwoscore = 0 numb = 38 begin: SCREEN 12 char = char + 1 IF char.240 THEN char = 1 ball = ASC(CHR$(char)) numb = numb + 38 CLS ' Draw a filled circle for our sprite CIRCLE (4, 3), 4, 4 PAINT (4, 3), 12, 4 xmin = 10 ymin = 10 xmax = 630 ymax = 470 x = 25 y = 25 dx = 1 dy = 1 curpos = 50 curtpos = 50 LINE (20, curpos)-(20, curpos + 100) LINE (620, curtpos)-(620, curtpos + 100) ' Get the sprite into the Ball% array GET (0, 0)-(8, 7), ball%() DO PRINT "Player 1 : "; ponescore; " Player 2 : "; ptwoscore IF x > xmax - 10 AND y >= curtpos AND y <= curtpos + 100 THEN dx = -1 ON ERROR GOTO errorthand IF x < xmin + 15 AND y >= curpos AND y <= curpos + 100 THEN dx = 1 ON ERROR GOTO errorhandle IF y > ymax - 5 THEN dy = -1 IF y < ymin + 5 THEN dy = 1 ' Display the sprite elsewhere on the screen x = x + dx y = y + dy PUT (x, y), ball%() ON ERROR GOTO errorthand LINE (20, curpos)-(20, curpos + 100) LINE (620, curtpos)-(620, curtpos + 100) FOR something% = 1 TO 10000 FOR ddd = 1 TO 50 NEXT ddd keypress: k$ = INKEY$ IF k$ <> "" THEN GOTO paddle NEXT something% CLS LOOP errorhandle: IF ERR = 5 THEN GOTO scorechange paddle: IF k$ = "w" THEN curpos = curpos - 2 IF k$ = "s" THEN curpos = curpos + 2 IF k$ = "8" THEN curtpos = curtpos - 2 IF k$ = "5" THEN curtpos = curtpos + 2 LINE (20, curpos)-(20, curpos + 100) LINE (620, curtpos)-(620, curtpos + 100) IF curpos < 1 THEN curpos = 1 IF curtpos < 1 THEN curtpos = 1 IF curpos > 379 THEN curpos = 379 IF curtpos > 379 THEN curtpos = 379 GOTO keypress scorechange: ponescore = ponescore + 1 GOTO begin errorthand: IF ERR > 0 THEN ptwoscore = ptwoscore + 1 GOTO begin END IF You use QB64. I love QB. Anyway, I looked at your program for like half and hour and I COULD not figure it out, but I think it has something to do with not resetting a variable after each loop.Fixed version. The WAY you had it was you were relying on an error occuring with the PUT in order to detect when the ball left the BOUNDS of the screen. I just added checks to interrogate that directly, add the appropriate score to the player that scored, and then return control to the begin. Problem was in the case of an error your code wasn't always passing control to BEGIN and therefore you would get an untrappable Illegal Function call on the next iteration when the x and y values make the PUT try to place graphics data outside the screen boundaries. Or so it seemed. I also 'fixed' your unnecessary large declaration of the ball away. you are only storing 72 pixels (9*8) so why do you need 30000000 indices? (could probably be reduced further, I'm not sure how GET Stores the video data) Code: [Select]' Set aside enough space to hold the sprite DIM ball%(72) ponescore = 0 ptwoscore = 0 numb = 38 begin: SCREEN 12 char = char + 1 IF char.240 THEN char = 1 ball = ASC(CHR$(char)) numb = numb + 38 CLS ' Draw a filled circle for our sprite CIRCLE (4, 3), 4, 4 PAINT (4, 3), 12, 4 xmin = 10 ymin = 10 xmax = 630 ymax = 470 x = 25 y = 25 dx = 1 dy = 1 curpos = 50 curtpos = 50 LINE (20, curpos)-(20, curpos + 100) LINE (620, curtpos)-(620, curtpos + 100) ' Get the sprite into the Ball% array GET (0, 0)-(8, 7), ball%() DO PRINT "Player 1 : "; ponescore; " Player 2 : "; ptwoscore x = x + dx y = y + dy IF x > xmax - 10 AND y >= curtpos AND y <= curtpos + 100 THEN dx = -1 IF x < xmin + 15 AND y >= curpos AND y <= curpos + 100 THEN dx = 1 IF y > ymax - 5 THEN dy = -1 IF y < ymin + 5 THEN dy = 1 IF x > xmax THEN ponescore = ponescore + 1 GOTO begin ELSEIF x < xmin THEN ptwoscore = ptwoscore + 1 GOTO begin END IF ' Display the sprite elsewhere on the screen ON ERROR GOTO errorthand OPEN "D:\debugqb.txt" FOR APPEND AS #3 PRINT #3, "X=" + STR$(x) + " Y=" + STR$(y) CLOSE #3 PUT (x, y), ball%() ON ERROR GOTO errorthand LINE (20, curpos)-(20, curpos + 100) LINE (620, curtpos)-(620, curtpos + 100) FOR something% = 1 TO 10000 FOR ddd = 1 TO 50 NEXT ddd keypress: k$ = INKEY$ IF k$ <> "" THEN GOTO paddle NEXT something% CLS LOOP errorhandle: IF ERR = 5 THEN GOTO scorechange paddle: IF k$ = "w" THEN curpos = curpos - 2 IF k$ = "s" THEN curpos = curpos + 2 IF k$ = "8" THEN curtpos = curtpos - 2 IF k$ = "5" THEN curtpos = curtpos + 2 LINE (20, curpos)-(20, curpos + 100) LINE (620, curtpos)-(620, curtpos + 100) IF curpos < 1 THEN curpos = 1 IF curtpos < 1 THEN curtpos = 1 IF curpos > 379 THEN curpos = 379 IF curtpos > 379 THEN curtpos = 379 GOTO keypress scorechange: ponescore = ponescore + 1 GOTO begin errorthand: IF ERR > 0 THEN ptwoscore = ptwoscore + 1 GOTO begin END IF |
|
12. |
Solve : c++ virtual books? |
Answer» Hi! Did someone ever FINDS a free C++ MANUAL in PDF?http://www.cplusplus.com/files/tutorial.pdf |
|
13. |
Solve : I want to add a single line from a list to a template and then save as bat file? |
Answer» In a For loop you have the x++ that adds 1 to x every loop. Here is the trim list I want to use in the template: 1. There are only 31 trim lines. Where does the 500 figure come from? (You want to process a text file with 500 lines? What is it called? What does it contain?) 2. The "final" template has the trim value "(94,153)" yet this is the ***first*** value of the trim list. Huh? I have done a bit of Avisynth/VirtualDub SCRIPTING so I understand a bit of this kind of thing, it might be helpful if you describe the TASK you are trying to accomplish. I need the bat file to do a trim of a source file. The trim will take a clip from a source file. I want to make the bat file and then double clip it and it will trim the clip from the source file. The first trim is from frame 0 to 93, this is the first scene, then the second clip is from frame 94 to 152, this is the second scene in the movie. Every trim is the beginning frame and end frame of a scene in the video. I was told that you can't do all the trims at once in a single script, you need to do the trims individually in their own encode. That 500 number is a imaginary number, the trim list is of a actual video clip from a trailer. Quote from: Me, before The "final" template has the trim value "(94,153)" yet this is the ***first*** value of the trim list. Huh?What I mean by Final is the MAKING of a new file. The first file is trim(0, 93) By doing the work I will make "a new file" with the trim(94, 152), then save this new file. Then I want to run this bat file and get the clip in the folder the bat file says it should be in. Then when I can do this this is the final result. I should have said final Result, and not just Final.You aren't explaining what you want to do clearly enough. Ok, I will clearly define what I want to do. Step 1.) I have a avs file that is a template; it has a line called Trim(). This template can be encoded using either a bat file or a avs encoder like megui. When the file is encoded it will save a video clip of the source file. This clip is only one scene though. In the trailer the frames go from from 0 to 1150, there are 25 scenes in there; 25 scenes makes 25 trim() in a list. I have this list of 25 trim, but I only have the template avs file and when that's used in encoding I only have one video clip. Step 2.) I want to create 25 different clips; all 25 scenes from the trailer. Step 3.) How do I use this avs template file, and this list of trim() and get all 25 scenes from the trailer? I need to change the trim() in the template file with a single new trim from the list of trim and then encode the template file and get the second clip from the trailer that shows the next scene. Step 4.) Now I have two clips, I need to get all 25 clips, somehow.Thanks. I will be having a look at this today and hope to post back later. |
|
14. |
Solve : Accidental hard drive format? |
Answer» Ok, so i know a little about computers, most of my experience is with web design but i would like to learn PROGRAMMING. My computer recently got a virus. I formatted my c: drive & now all my computer does is come on & go to a black screen that says bootmgr is MISSING. Basically i would like to GET some help & learn how to get it up & running again. I know this will not be an easy task but i just want to do it for personal knowledge. What would i have to do & where would i start? Be as detailed as possible, i am a beginner but i also am very interested in computer programming.How did you go about formatting the drive? Are you sure you formatted the drive? If so, you will need to install an OPERATING system. Insert your OS CD, make sure the cd drive is the first device in the bios boot order, and reboot. The installation routine for the OS will begin. |
|
15. |
Solve : Limits on int's in c++? |
Answer» Hey, |
|
16. |
Solve : Batch Files, Select all files EXCEPT? |
Answer» I'm creating a batch script that will filter out files from a folder and move them elsewhere. How would I go about selecting all files EXCEPT .PDF files and move them to another folder? You could use FOR /F to parse the OUTPUT of DIR /B piped through FIND /V ".PDF". Quote from: Salmon Trout on May 13, 2011, 12:42:32 PM You could use FOR /F to parse the output of DIR /B piped through FIND /V ".PDF". LOGIC is wrong (if I'm not mistaken) Your asking to call DIR for all files in directory, then find all .PDF files and assign them to variables. I want to find files EXCEPT for .PDF files. I don't want the .PDF files selected. Either case I attempted to run the code and it returned "More?" indefinitely unless terminated. I'm really not sure if this is possible You are mistaken. The logic is fine. The problem is you don't know that the /V switch makes FIND ignore all items containing the specified string. You could have found this by typing FIND /? at the prompt. Another way is to use FOR to list all files in the directory, and in the loop, use the ~x variable modifier to isolate each file's extension and if it is not ".pdf", perform the move operation. (see FOR /? for details.) Quote I attempted to run the code What code? I don't see any. You really should post the code you are running and state how you are trying to run it, if you want help that is more specific. Quote I'm creating a batch script Why so shy about posting what you have done so far? I apologize as the logic is correct. overlooked the /v switch. But it seems as though for /f doesn't like the command dir | find. This is what I used to test. (directly in cmd not batch) for /F %G IN (dir /s /a /b c:\test\ | find /v ".pdf") do "c:\Program Files\Mozilla Thunderbird\thunderbird.exe" -compose "to='[email protected]',subject='Non-PDF File',preselectid='id',body='Please ensure that the entity is sending us a PDF file and not any other file type. Attached is the file in question.',attachment='%G'" it returns: "| was unexpected at this time." i tried doing ("dir /s /a /b c:\test\ | find /v '.pdf'") ("dir /s /a /b c:\test\"|"find /v '.pdf'") ('dir /s /a /b c:\test\'|'find /v ".pdf"') ('dir /s /a /b c:\test\ | find /v ".pdf"') all returning the same error. it works fine if it's not a part of the FOR command however. p.s. Yes I know it's not a move command Pardon me. Could one not just use the ATTRIB command? Code: [Select]ATTRIB +H *.PDF dir /bjeez u make me work so hard... i created this and it works: dir /s /b /a:-d c:\test\ > c:\TEMP\dir.txt for /f "tokens=*" %%G IN ('find /V /I ".pdf" c:\TEMP\dir.txt') do "c:\Program Files\Mozilla Thunderbird\thunderbird.exe" -compose "to='[email protected]',subject='Non-PDF File',preselectid='id',body='Please ensure that the entity is sending us a PDF file and not any other file type. Attached is the file in question.',attachment='%%G'" but i think setting the attribute then doing dir will be easier. cause then I can set variables directly from dir instead of dir piped through find anyways. Just have to remember to put attrib -h *.pdf towards the end of the functionconfirmed works beautifully Final Code Code: [Select]attrib +h *.pdf for /f "tokens=*" %%G IN ('dir /s /b c:\test\') do "c:\Program Files\Mozilla Thunderbird\thunderbird.exe" -compose "to='[email protected]',subject='Non-PDF File',preselectid='id',body='Please ensure that the entity is sending us a PDF file and not any other file type. Attached is the file in question.',attachment='%%G'" attrib -h *.pdf now if I could just figure out a way to add a comma onto the end of the file names via this method when it gets inserted into the Thunderbird compose command... then I can send all of them via 1 email =D Quote from: mechaflash on May 13, 2011, 02:30:49 PM "| was unexpected at this time." You have to escape the pipe symbol with a caret thus: ^| Quote from: mechaflash on May 13, 2011, 03:30:39 PM put attrib -h *.pdf towards the end of the function This is a daft idea. I suspect geek has has some kind of cerebro-vascular accident, the way he has been posting lately. Or perhaps that is his default mode? Still, you are perfectly free to accept his kludgy workaround. Quote from: mechaflash on May 13, 2011, 03:33:35 PM works beautifully They say beauty is in the eye of the beholder Quote from: Salmon Trout on May 13, 2011, 01:05:33 PM Another way is to use FOR to list all files in the directory, and in the loop, use the ~x variable modifier to isolate each file's extension and if it is not ".pdf", perform the move operation. (see FOR /? for details.) Personally I prefer this approach; it targets the ACTUAL file extension rather than picking up every file which has the string ".pdf" somewhere in its name Use one percent sign for the variable ("%A") at the prompt and two percent signs in a batch script ("%%A") Code: [Select]for %A in (*.*) do if not "%~xA"==".pdf" echo Moving %A & move "%A" "C:\Path\Folder"Total program thus far... (pain in the *censored* to get it to put the files the way I need it to for it to compose as attachments in a thunderbird email) Code: [Select]echo off SETLOCAL ENABLEDELAYEDEXPANSION CD c:\test\ REM Hide all PDF files from commands ATTRIB +H *.pdf REM Output directory/names of files to c:\temp\dir.txt Alphabetically DIR /S /B /O:N>c:\TEMP\dir.txt CD c:\temp\ REM Read last line in file and output to file c:\temp\last.txt FOR /F "tokens=*" %%F IN (dir.txt) DO echo %%F>c:\temp\last.txt REM Count the lines in file set /a count=-1 for /F %%a in (dir.txt) DO set /a count=!count!+1 REM Create empty temp file copy /y NUL tempfile.txt >NUL REM Copy all but last line for /F %%F in (dir.txt) DO ( IF /I !count! GTR 0 ( echo %%F,>>tempfile.txt set /a count=!count!-1 ) ) REM overwrite original file, delete temp file copy /y tempfile.txt dir.txt >NUL del tempfile.txt REM output the last file back into dir.txt (without comma) for /F %%F in (last.txt) DO echo %%F>>dir.txt REM Compose email with attachments, loop once for all lines set /a count=1 for /F "tokens=* delims=" %%F in (dir.txt) DO ( IF /I !count! GTR 0 ( "c:\Program Files\Mozilla Thunderbird\thunderbird.exe" -compose "to='[email protected]',subject='Non-PDF File',preselectid='id',body='Please ensure that the entity is sending us a PDF file and not any other file type. Attached is the file in question.',attachment='%%F'" set /a count=!count!-1 ) ) REM Change back attributes ATTRIB -H *.pdf REM Cleanup del attach.txt dir.txt last.txt OFFLOCAL Here's my problem... I need to have ALL of the files attach at the end of the compose command... but because it's a "for each" type of statement it will loop it for every file telling it to compose a new email. I set it up to where there is a comma after each file except for the last one in the list so when it composes it will be file1,file2,file3,lastfile because Thunderbird needs it formatted in such a way. How would I go about just reading all the lines in attach.txt and grabbing it as ONE string to insert? Or is there a way to use FOR to grab all lines at once? THANKS!Salmon Trout I've never used tilde functions in batch scripting before. I've found the MSDN site that has some information but I'm still not comprehending it. Do you know of any good reference sites that have examples and explanations of usage? |
|
17. |
Solve : what features do you love most and what could be added in a media player?? |
Answer» i am getting ready to create a media player and i would like to know what are the main features that users such as yourselves have always wanted or have in another media player..I was thinking the one day that a media player sort of like iTunes for music that created play lists for videos to play them back to back or Random. I dont know of any players yet for videos that have this ability to create video play lists and run A to Z or Random yet. I suspect based on some other posts by the Original Poster that their "Media Player" is nothing more then a thin wrapper around Windows Media Player using it's Control widget that can be inserted into an application. I bet you're right, but I had a good idea anyway... This would be hard to do, but I think it would be nice to have a feature where you input a youtube URL and it begins streaming only the audio of the flv. While it's streaming, it's being converted to an MP3, so when your done listening, you can choose to save an MP3 or not. It also would have a little search bar at the top where you could search for "videos" and convert them. I know that there are already addons for web browsers that allow you to convert a youtube video to MP3, but this would be better because you would only use half the bandwidth. The reason is because on youtube, you have to watch the video, then the server that converts it also has to, so it's using twice the bandwidth because the video is accessed twice instead of just once. Also, if there were any "audio pirating issues" you could just say. "Arn't you glad we are saving half of your server's bandwidth " I know this seems like more of an idea for a audio player instead of a video player, but whatever. Actually, I might make something like this. Quote from: BC_Programmer on April 28, 2011, 04:25:04 AM I suspect based on some other posts by the Original Poster that their "Media Player" is nothing more then a thin wrapper around Windows Media Player using it's Control widget that can be inserted into an application. Now mate, i am planning to do a complete OVERHAUL on the design and fuctionality, i am not interested in just using a "thin wrapper around windows media player" because i feel that they all have a good feature or two and i want to combine them into a total package. but i do thank you for your input "BC_Programmer" Quote from: Linux711 on April 28, 2011, 11:50:26 AM I think it would be nice to have a feature where you input a youtube URL and it begins streaming only the audio of the flv. While it's streaming, it's being converted to an MP3, so when your done listening, you can choose to save an MP3 or not. It also would have a little search bar at the top where you could search for "videos" and convert them. Thank you Linuz711, I like your idea, although i agree that it will be difficult to input... Quote from: DaveLembke on April 22, 2011, 09:16:06 PM My HTPC right now is a last generation Pentium 4 HT, running Windows XP SP3. And I created a simple HTML interface that launches through startup to select and play movies from etc. I have a video capture card in it that gives me the ability to convert movies to digital as well as use it as a DVR as well as it has a video card with older s-video out. BUT it isnt HD given that its s-video. LOL! now DaveLembke, that is interesting and funny... but wat does it exactly have to do with this particular thread? do you happen to have any ideas maybe? Quote from: MusoFreak200 on May 03, 2011, 09:27:59 PM Now mate, i am planning to do a complete overhaul on the design and fuctionality,I'm not even sure what you mean here. Is there something wrong with the current general design and functionality of existing media players? Quote i am not interested in just using a "thin wrapper around windows media player"Good. Quote because i feel that they all have a good feature or two and i want to combine them into a total package.Well you should ask the important questions first. Like what sound library you'll use, or whether you will write your own, how you interact with that sound library, etc. Whether your playlist happens to be able to sort A-Z or randomly is a trivial detail that can be handled after the important stuff is out of the way. Quote from: BC_Programmer on May 03, 2011, 09:53:18 PM Well you should ask the important questions first. Like what sound library you'll use, or whether you will write your own, how you interact with that sound library, etc. Whether your playlist happens to be able to sort A-Z or randomly is a trivial detail that can be handled after the important stuff is out of the way. well mate, what is it that you say you would like a sound library to be like, and in your opinion do you like the interaction to be like? what features in this aspect do you favour? any time of yours on this matter would be very much apprieciated |
|
18. |
Solve : NOOB wants to learn!? |
Answer» Hi, i'm just a 13 year old kid, that loves computers and programming but wants to really get into it but has no idea where to start. really would appreciate some expert help, as i personally think we need more youngins into this kinda stuff! enjoy and look me up when your rich :p unjustified optimism breeds incompetence. Quote from: RepublicOfLlama on April 17, 2011, 09:45:36 PM Hi, i'm just a 13 year old kid, that loves computers and programming but wants to really get into it but has no idea where to start. really would appreciate some expert help, as i personally think we need more youngins into this kinda stuff! Before programming, know how computers work; e.g. filesystems, memory, how to use the Command Prompt and why, etc.. I once taught someone a programming language right up to file input-output and then had to teach them on the spot how file paths worked. It was no wonder after that why everything seemed so hard to them. If you want to take it nice and slow and not asplode your mind, then learn a simple programming language or scripting language like QBasic, or maybe even VB. These are simple and won't fully satisfy your cravings, but learning them will make languages which really do move mountains like C/C++ for example a lot easier. Whatever path you take always try out new things you learn for yourself and make example code suit you, this is good practice and will speed up learning and understanding of any computer language. If you're reading and feel like you're not taking anything in, stop, and then look over the content and make sure you do learn it. Tinker with code you find and try to make sense of it, and this helps learn coding conventions and practices that people use to code with which makes coding more professional and easier to share and get help with. I hope you have the willpower and potential to go through with it and live your dream. And when you're posting your age whilst refering to the complexities you're dealing with it makes you look like a big-head and isn't really relevent. Programmers have different levels of talents and rarely correlate to what age they are or what age they started at. "I'm just a 13 year old kid" happens to be far too overused, not just in programming but everywhere that requires training and skill. Quote from: BC_Programmer on April 18, 2011, 04:07:56 AM unjustified optimism breeds incompetence. Love you BCThe world does not need more computer programmers. You know what I mean. Learn how to teach others to benefit themselves. Bigger challenge, better rewards. Consider your computer a hobby, not your vocation. Quote If you want to take it nice and slow and not asplode your mind, then learn a simple programming language or scripting language like QBasic, or maybe even VB. I agree, but your going to make BC programmer's head explode. Because according to him, people that learn BASIC become mentally mutilated twords other programming languages. Quote from: Linux711 on May 05, 2011, 11:05:27 AM Because according to him, people that learn BASIC become mentally mutilated twords other programming languages. Please quote me. I don't recall saying that. It would be a stupid thing to say since I used VB6 for like 6 years. and if I did, I was paraphrasing (in fact chances are I quite literally had a quote) Edsger Dijkstra, If you would like to refute his authority over Computer Science be my guest. his exact quote was "It is practically impossible to teach good programming to students that have had a prior exposure to BASIC: as potential programmers they are mentally mutilated beyond hope of regeneration.". And it is true, except for the "regeneration" part. Also, it's less of a problem with more modern basic dialects that have abandoned some of the old standby's that were still leftover from BASICA. In this case "my problem" in this case wouldn't be so much to do with BASIC, it's using 16-bit DOS environments in 2011 that is ridiculous, particularly given the fact that it's been superseded by VB (mentioned) FreeBASIC (not mentioned) as well as a tool designed for this use case, SmallBasic. What makes the choice bit more difficult is age. I didn't own a computer until I was 16 so I can't really relate very well to being 13 and wanting to do stuff on a computer. SmallBasic is probably the best fit here, since it's specifically designed for this type of scenario. Additionally, I didn't even say anything about basic at all in this thread, my only contribution was to warn another contributor that it's a bad idea to make somebody think it will all be fun and games and easy, since they will simply get frustrated easier, And even if they are able to get through it, unless they find it as super mega easy as was implied they might get a bit of "imposter's syndrome". Truly I wouldn't have even posted again had you not basically flamed me and misquoted me as being the source of something which I was not. Talk about mentally mutilated. Quote from: BC_Programmer on May 05, 2011, 12:28:18 PM I didn't own a computer until I was 16 so I can't really relate very well to being 13 and wanting to do stuff on a computer I can relate to that. I was 28 before I had a computer. Mind you, that was in 1980. The first language I learned to use was 6502 assembler. Edsger W.Dijkstra is quoted over 25 years after his essay. Quote University of Virginia, Department of Computer ScienceLooking at part of the essay, he also wrote back in 1975: Quote ...Intel has a new version of FORTRAN. Microsoft offers Visual BASIC. IBM still offers COBOL and PL/1. Edsger W.Dijkstra is remembered by some people. His work was significant http://en.wikipedia.org/wiki/Edsger_W._Dijkstra This once famous Dutchman died in 2002. Quote from: Geek-9pm on May 05, 2011, 03:09:14 PM This once famous Dutchman died in 2002. Er, he's still famous, actually. Quote from: Salmon Trout on May 05, 2011, 03:39:08 PM Quote from: Geek-9pm on Today at 03:09:14 PMYes, I stand corrected. (foot in moth icon) The article on Wikipedia shows the power and range of his work continues. Works by Edsger W.Dijkstra can be found on a Google search. The NOOB who wants to learn may want to read this one. http://cacm.acm.org/magazines/2010/8/96632-an-interview-with-edsger-w-dijkstra/fulltext Quote from: BC_Programmer on April 18, 2011, 04:07:56 AM unjustified optimism breeds incompetence. I'd much rather see unjustified optimism than unjustified pessimism. I learned fortran and basic in college. Never used fortran again, but the logic and thinking I learned from each helped me with several other languages. What's the most important is the thinking behind solving the problem rather than the language used.BASIC insults: I first started learning GW-BASIC on an old DOS computer. If I didn't have my first steps in something basic like that, it would have been very difficult for me to move to QuickBASIC and then to VB6. (Also VB .NET) I recommend first learning about memory and file oddities, then starting with some drag-drop "programming language" like Scratch or Game Maker (for easy game programming). Then there are good tutorial sites for various languages. Easy - just search the Web. Good luck FLEEXY Quote from: Fleexy on May 06, 2011, 06:45:46 PM BASIC insultsThere aren't any in this thread. With the exception of the quotation from a distinguished academic in the field who I assume knew what he was talking about. Quote I first started learning GW-BASIC on an old DOS computer. If I didn't have my first steps in something basic like that, it would have been very difficult for me to move to QuickBASIC and then to VB6. (Also VB .NET)That's a rather silly conclusion. My first steps were batch and then QBASIC & QuickBASIC, I didn't use BASICA or GW-BASIC before that. It simply doesn't matter what you start with. Quote I recommend first learning about memory and file odditiesI recommend first learning the language being chosen. Also not sure what you could mean by "oddities" unless you mean "well documented standard operations". The only time those few quirks in modern operating SYSTEMS with relation to memory and disk space usage even matter would be if one was using a programming language that even let you deal with those low-level details, which sort of excludes almost all present dialects of BASIC. (and a good portion of other languages as well). Quote then starting with some drag-drop "programming language" like Scratch <I hate it, but a lot of others like it> or Game Maker (for easy game programming). Then there are good tutorial sites for various languages. Easy - just search the Web.programs like clipper, game maker, Scratch (whatever that is) and it's ilk have some serious problems from a programming perspective. First: they want to learn about computers and programming. These hardly serve that purpose. I can't speak for scratch, but I know most tools of this nature aren't designed to teach about programming concepts, and instead they are specifically designed to hide them. The thing is, the expression "No need to reinvent the wheel" is often used to defend these products, and it's such a silly excuse, especially in this context. the Original Poster basically wants to learn how the wheel works, not build a wagon. I'm not saying the tools themselves are bad, but rather that they aren't the most ideal entry point when learning programming; people used, say, clipper, for creating small applications that deal with a database; Game Maker is designed f or, unsurprisingly, creating games. Scratch, from what a short google makes me believe, seems more similar to Flash; in that you draw components and the language constructs are used to mess about with those components (much like actionscript) of course this also has a relatively limited use-base; mostly for, as the site explains, "interactive stories, animations, games, music, and art" Now this can be conceived of rather broadly but it still isn't a general programming language. Again, I want to reiterate, not that these are bad programs/languages but rather that they are designed for non-programmers, and also for people who currently have no real interest in programming but rather in the creation of the end result. Another prime example of this type of application/language is something like LOGO; And I'm sure a lot of kids became interested in computers because of logo. Thing is, it really oversimplifies things; I mean, that is what it's supposed to do, but if LOGO was the only interaction experience I had telling a computer what to do I would have never even explored programming further. I got more out of writing batch files then I did creating a LOGO "program". The important thing here is that tools like scratch, clipper, Game Maker, and even Visual Basic 6 are more shallow tidal pools on the beach of the programming ocean. If all you want to find are some pretty shells -create a game, basic database UI, animation, simple game etc - then they work fine, but some people are more interested in how those shells form and they will need to swim into the ocean to find out. (Visual Basic 6 is sort of on the fence since in a way it doesn't make the more complicated stuff impossible but it makes it seem so a lot of the time... just try implementing IEnumVariant for tons of fun). Basically, the tools don't teach programming or programming concepts, they over-simplfy them; and while this is all well and good when the product being created (game, animation, etc) is the goal, it isn't when you want to learn about programming because the goal there is to basically acquire the mental tools to do that stuff yourself. That isn't to say there isn't a market for people that are experienced with game maker, anybody who thinks there isn't a market for people who basically rip off another game engine and inject their own scripts and images into it are kidding themselves, because those type of games simply fill the bargain bins everywhere). A corresponding type of application are things like frontpage, Dreamweaver, and other HTML editing UI tools. The point of those tools isn't to teach their user about HTML, it's to make a website; you don't use a dreamweaver template to learn about HTML, javascript, and CSS, but for the exact opposite reason. In the same vein, a person shouldn't use game maker if they want to learn how to create games, but rather how to design games. Again, I don't want to give the impression that I think such tools are stupid, or useless entirely, they are simply useless in the context of learning programming in general- that is, how the wheel is made, not how it works, because that is what the OP is asking for. It may very well be that they are in fact interested in simply making games or (heaven forbid) database applications, in which case the suggested tools of that nature would suite the purpose quite nicely. Quote from: rthompson80819 on May 05, 2011, 04:06:22 PM I'd much rather see unjustified optimism than unjustified pessimism.If that was aimed at me, I am no unjustly pessimistic; just being realistic. If they haven't done anything programming wise it's silly to think that just because they are interested in learning they will become the next "Bill Gates" (Which is more a question of being a good businessman rather then a good programmer the way it is often MEANT to mean). That would be like me expressing an interest in nature and being told I'll be the next Jane Goodall- it's preemptive optimism. Unless there has been a demonstrated aptitude for the SUBJECT matter, it's a rather silly thing to say seriously. Quote What's the most important is the thinking behind solving the problem rather than the language used.Yes, but different languages often require different thinking. in C, you could create subroutines, in early versions of BASIC you cannot. in Visual Basic 4 and later, you can create class modules and object heirarchies that you can't create in earlier versions and that completely change the landscape of the language. When the topography of a location changes so too must the way you attack that location. You cannot really create a linkedlist without hacking around the limitations of the language in QuickBasic, for example. |
|
19. |
Solve : C++ Strings, headers and noob.? |
Answer» Hello all, |
|
20. |
Solve : How to properly calculate rating?? |
Answer» HEY guys, I have a rating for various items on my site and I would like to make sure that "top rated" section works properly. For example, let's call OBJECT 1 - Item1 and object 2 - Item2. Objects are rated out of 5, no decimal. If Item1 has been rated 5 twice this makes average rating of 5. (10 divide by 2 equals 5). AND Item2 is rated 12 twice using different ratings which averages to 4 out of 5. If I were to display these items by highest rated objects would be displayed Item1 first and Item2 second. My problem, what's the formula for CALCULATING proper rating? The way I see it Item2 should be higher than Item1 because it has more ratings EVEN though it's average rating is 4 which is close enough to 5. Any ideas? Thanks in advance. |
|
21. |
Solve : problem with jlist? |
Answer» Hi all, |
|
22. |
Solve : Excel Upper to lower to Proper? |
Answer» This formula use to work in macros to go from lower to upper to proper. Now it does not. Did I leave something out? Did I not follow the procedure properly Sub ToggleCase() Dim rng As Range Dim strVal As String If Selection Is Nothing Then Exit Sub End If For Each rng In Selection If Not rng.HasFormula Then strVal = rng.Value If strVal = UCase(strVal) Then rng.Value = LCase(strVal) ElseIf strVal = LCase(strVal) Then rng.Value = StrConv(strVal, vbProperCase) Else rng.Value = UCase(strVal) End If End If Next rng Set rng = Nothing End Sub 1. Go to the developer tab ( To GET developer tab, Right click Office button, top left; click in excel OPTIONS at the bottom right, click on third box down, ‘Show developer tab in ribbon’.) 2. Macro security on the left 3. Click on ‘enable all macros’ 4. Click Record macros. Put in a NAME and a short cut key 5. Click on Macros 6. Click edit 7. Remove what is there and paste code 8. When you wan to use, highlight, click on macros and hit run Thank You Rodney Are you sure? Did you copy it verbatim? Be very careful of elseif else and endif. It would help if you would do better indentation so what you INTENTIONED be obvious. It works for me in Excel 2007. (Alt+F11, Insert->Module, Pasted, and then used from the "view" tab on the ribbon, VIA the Macros dropdown) |
|
23. |
Solve : What is a language and what isn't?? |
Answer» I have a very good question. Is Visual Basic a REAL programing language? I got into a little fight over this and I really want to know. Yes you can write "ok" applications in it, but to me it's just a man's way of being lazy. There is a big difference from using a Line tool in vb to draw a line or writting script that will draw it in C. One way takes 2 or 3 clicks and the other way takes some words to type. What do you think? Quote from: HelpDude88 on July 11, 2011, 08:34:45 PM I have a very good question. Is Visual Basic a REAL programing language?Yes. Quote Yes you can write "ok" applications in itPlenty of applications are written in Visual Basic. For a while, many of Microsofts own free tools- it's older Windows Antispyware program, for example- were written in VB6. Quote but to me it's just a man's way of being lazy.No, it's a way of avoiding typing out the same boilerplate code over and over. Quote There is a big difference from using a Line tool in vb to draw a line or writting script that will draw it in C. A: it's a Line "Control", and nobody beyond the beginner level uses either Shape or Line controls for MUCH more than basic decoration (that is, they aren't used for interactive elements). B:) C is not a scripting language. And yes, there definitely is a big difference between using the line tool in VB and writing it in C; the C version would be at least 5 pages long (remember, you need all the boilerplate stuff, including Registering the Window classes and creating the windows and managing the returned HINSTANCE and HWND from those functions, and hooking up the Window procedure and responding to the appropriate events (in this CASE WM_PAINT) using BeginPaint() to get a usable Device Context to draw to, drawing onto that DC using MoveToEx() and LineTo() and then calling EndPaint(), and then running it and making sure it works. Whereas with VB6 you simply put the control on a form. The only programmers or people that are opposed to this type of simplicity are the elitists who think that even basic programming should be hard. And as far as I'm concerned they can go straight to *censored*. There is no reason programming should be hard, and even less reason to make otherwise simple tasks needlessly complicated. Quote One way takes 2 or 3 clicks and the other way takes some words to type. What do you think?The thing is, you can do the "C way" just fine in VB6, by handling the paint event of the form or picturebox. You could, if you wanted to, simply have the program start in a "Sub Main()" routine and use the Windows API to register a window class (or possibly just use the existing "ThunderForm" class that VB6 and earlier would use) and create windows, and handle their message pumps and whatnot. But that is pointless since VB6 already deals with that. It makes 98% of what you need to do (or what usually needed to be done in 1998) easy; the remaining 2% is a huge pain in the *censored*. (Implementing IEnumVariant, for example). If you are in fact referring to VB.NET, there is no Line control. VB.NET is pretty much equivalent to C# in ability. Of course they both use that "Evil framework" that some people look on with chagrin, apparently because they think people should have to roll their own queue's and stacks and other crap every time they need one, which is nonsense. (and, with earlier versions of Visual Basic, you would have to roll your own stack's, queues, LinkedLists, Trees, and other structures- and Sorting routines (and yet the C standard library comes with qsort...)BC, he swats to win an argument. Noways nobody ever reads anything. Unless its in Twitter or Facebook. Many years ago, men and women who needed to program computers read real books and went to real classes. The was an ACADEMIC definition of a programming language. The ability to draw lines was never a principal criteria. But the ability to control a machine to produces something that had a great deal of complex order was a meaningful objective. This quote is a general and fair definition. Quote Programming language No suggestion that any computer dialect is disqualified, because it is not presently used to write real-time war games, was given in the article quoted.. Also, arguing about what computer programming language is best is the equivalent of engineers who want to build a bridge arguing about the brand of paper to get their blueprints on. And no, programming languages are not analogous to different tools, like screwdrivers and hammers. Computer Programming languages all have a single goal; to tell the computer what to do. It's the equivalent of arguing what Human language is best; in that case, C would pretty much be the equivalent of English. However just because English has become the "dominant" language overall doesn't mean it is the best; just as C being one of the most widely used doesn't make it the best (on account of it not actually being the most widely used; the programming language with the most lines of code written is supposedly Visual Basic, which passed COBOL sometime in the late 90's. ) For the most part, the arguments I hear constantly for "Visual Basic is not a language" all stem from a complete, pig-headed refusal to actually understand what it entails to create a non-trivial program in Visual Basic. the "Visual" part is purely for the GUI elements. Try writing a piece of code to display the right-click context menu and it will be longer in VB6 than the equivalent C code to do the same thing.To the OP. Tell you antagonist that there was an old Geek from the Old School wo says that real men do not ever use languages. The sit in front of a panel with lights and twitches. No display. No keyboard. Just lights and switches. And a wire-wrap tool. And a box of spare relays, circa 1959. |
|
24. |
Solve : Help with Batch Programming? |
Answer» Hello everyone, |
|
25. |
Solve : How to run multi copies of the same game on different cores? |
Answer» Hello! (Please redirect to the right forum if i am not posting in the good one) Here is my PROBLEM. I play a GAME that i open 4 times in 4 different screens. So I am running the same game x4. The problem is that they are all running under the same core and i have a quad core. So basically my first core is like 100% used and the 3 others are barely not even been used. I can see this when i press ctrl-alt-del and look at the core graphic panel. I was wondering if there was a way to make my games run on different cores so the first one can be less used. Something like 1 game per core or I don't know, but anything that could make the 1st core been less used. CPU info: AMD AthlonII x4 635 Processor 2.9 GHZ 2G Ram DDR2 800mhz OS: Windows Xp Let me know if I am not enough clear! Thanks for the help.Open task man and right click the PROCESS itself and click 'Set Affinity' you'll have the option of setting it to the core you want. QUOTE from: Linux711 on May 23, 2011, 11:20:37 AM Open task man and right click the process itself and click 'Set Affinity' you'll have the option of setting it to the core you want. Oh nice, thanks. It works for some process, but it's not working for my games >.< It says something like '' The operation cannot be done. Acess refused '' There is probably a way to bypass this, i'll try to figure it out. Let me know if any of you know how. Thanks!you could try to force it with something like Process Explorer.I just got to ask what games are you trying to run 4 times at once? |
|
26. |
Solve : pushing input to a program using run command? |
Answer» Hey, |
|
27. |
Solve : Drawing a blank on C++ and write " " to file? |
Answer» Drawing a blank on how to write "." to config.conf file without C++ thinking " " is the start and stop of string to write to file. Did a quick google search for like cout<<"""\n"; to display "" and no results, since this is related to the same problem. 'for escape character. Now I know its Quote \. Was thinking it was like cout<<"Print this '".'" \n"; Figured not to include that in my post for help since it was way wrong. Also forgot the correct terminology of "Escaping", but knew that there was a way to lead it with another character to have it ignore the " inside the string to print or write. Been playing with C++ off and on for last 13 years, and it wasnt until now that I need to MAKE a dynamic config file that I ran into this issue, since I normally dont quote out information to user or to files. When I went to compile my source and saw the many errors blatting about the same thing I was like hmm its looking at those quotes and way back in 1998 I remember the college professor going into this issue and that a leading character tagged the quotes as ignore, but what was it and what was the correct terminology for what I need to do, which you answered both. Thanks |
|
28. |
Solve : C++ 6.0 - Console Program write to file causes cout display text to vanish? |
Answer» I have a C++ 6.0 program that displays to the user in the dos shell ( console program ) as to what it is doing, but instead it displaying what is happening as I would expect to have happen, the text flashes for a second and then I get a flashing cursor until the outside secondary process is complete at which point the text I wanted to have DISPLAYED to let the user know what process is happening is displayed. You can also try: several points: 1. the system call is part of the C standard library. there is no need to include windows.h to use it. 2. cls probably doesn't fix the problem, since the problem is that the expected text is appearing later than expected, not that it's appearing and it's not wanted. 3. (purely IMO, and perhaps more general). using functions to execute external programs to perform "core" functionality demonstrates absolutely nothing but a lack of research. For example, take using system("cls"). First, off, that is only going to work on a windows/DOS machine. running that on a *nix machine will not work since the proper command for that is clear. "so add conditionals" you might say. true, but why do all that when you can just use scrclr(); from the C Standard library (conio.h) to clear the screen? Or you could use any number of console I/O libraries such as ncurses. Additionally, a good rule of thumb is that unless you are a front-end for some other application or the application you are creating is specifically designed for executing some other program, you shouldn't use system at all, much less for basic things like "pause" and "cls" and so forth. some possible responses: "well golly gee BC, I use it and it get's the job done, what's wrong with that". Well yes, of course it works- for you, at that particular moment, on that particular system. The entire purpose of writing a C++ program as opposed to say a batch program is to get better portability, faster SPEED, and a more diverse programming environment, but when you use the system() call (and this counts for the equivalents in other languages, such as Shell() and exec() and all that) you are basically saying "I'd much rather be writing a batch script, I only wrote this so I can say I wrote it in C++". "But it's code reuse!" No, it's not. for one thing, most of the things you would use system() for (ASIDE from of course if your application is designed to run an external program) are either present as part of the standard library of nearly any Console-capable language, and those are aren't available are easily built from that. Whatever the arguments for using System() are, they are far outweighed by the cons. for one thing- using system almost always makes you dependent on a platform. Now again that may bring up the "well I just needed it quickly", and that seems reasonable, but when your C++ program is merely a loop making a few system() calls, you may as well have created it as a batch file to begin with. Especially since using a series of System() calls is slower than just using a batch script, so there goes one (mostly dubious) advantage. Not to mention writing said batch script would be orders of magnitudes faster then writing, linking, and compiling a C++ program that simply calls system a few times. -It's resource heavy. Think about it. system() basically executes not just one, but maybe two separate processes (the command interpreter and then the other program, for example) and returns an exit status to your program (hopefully the exit status from the program you are attempting to run). Not to mention everything that could go wrong. the user could not HAVE that program, they could be on a separate OS using a different command interpreter that doesn't understand the syntax, or doesn't posess the inbuilt commands you assume exist everywhere (using system("cls") on a *nix machine, for example). And what if the user doesn't have permission to execute the command? What then? how do you handle errors? of a system("cls") call fails, what do you do? not clear the screen? show an error? Really, I can't even understand why anybody would ever use system() for this type of thing, nor why it seems so popular (for hobbyist programmers, presumably professional/experienced programmers use system() when they want to start an external program, not just because they want to clear the screen) Let's take another common example: system("pause"). Yes- it will pause a program. This pause can be helpful if the IDE you are using to TEST your program doesn't insert it's own "implied" pause or doesn't keep the window open when your application finishes so you can see the results. But really, using system("pause") is like burning your GPS unit when you are lost on a desert island to make smoke signals. Many people- and this includes so-called "instructors" who are supposed to know what they are doing but seldom do (that's why they are instructors, and not actually working in the industry, but I digress) for some inexplicable reason they believe that making a call to the command interpreter (cmd, bash, what have you) and running a system command to temporarily halt a program is a good thing. In the words of Babbage, "I cannot rightly apprehend the confusion of ideas that leads to such a conclusion". First, as I've already noted, it's not portable. system("pause") only works on DOS/Windows Machines, and no others. Second, as I also noted- it's very resource heavy. system() suspends your program, makes a call to the Operating System, which often relaunches the command interpreter as a sub-process (or child process on windows), the command interpreter parses the command, searches for the appropriate program, allocates memory to run said program, passes that program any arguments you gave, monitors the program's Process to wait until it exits, free the memory it allocated for running the program and returns the exit code to your program, having to perform similar cleanup for any processes that were spawned in the process. One problem with this approach is that it makes for a built-in security flaw. Both systems can have their search path's hijacked and built in tools can be replaced locally with compromised ones. Arguably by that time the user has lost, but if your program is run with root privs and you shell out to some other application at any point, you better make damned sure if you use any user input it's well protected against buffer overflows, and even then you have to make sure the rest of your application is safe from buffer overflows as well because a clever hacker could easily just add a few nop sleds and mess about with memory in such a way that your system() call in one part of your program can have it's arguments changed merely because you used a printf() call with a single argument and using user input. Considering all these problems, and the fact that there are much cleaner ways included in the language itself that make all this unnecessary, you have to include headers you otherwise might not need (if you are "properly" programming in C++ you shouldn't be using or conio), in the end it's just a bad habit that you'll have to break away from eventually anyway. I mean, really, how is system("pause") really that much easier then Code: [Select]printf("Press any key to continue..."); getch(); It's not, it merely indicates a clear lack of research into their problem. "oh, I need to clear the screen, oh hey, I can use system and I know the OS has a "cls" command I can use! YAY" A quick google for "Clear screen with C++" or "Clear screen with C" presents a multitude of solutions... although the ratio to those that suggest the use of system() in some way is dismally high. Many good points BC, noted |
|
29. |
Solve : C++ 6.0 internal heap limit reached ?? |
Answer» Ran into a minor issue with my program where I have reached the heap limit and I am not sure how to fix this. The message when trying to compile states "use /Zm to specify a higher limit", and I am not sure if I should adjust this limit which I have never had to do before, or MAKE the program open -> write appending -> close multiple times instead of just opening at the beginning of the program and then closing at the end. Adding open and close statements which I would have expected to clear the heap, the compiler also does not like. I also tried closing the file earlier in the program and then declare a new myfile2 vs myfile, thinking that it would use a new heap with a different function identifier, but that it also seems to lot like ofstream myfile2; Here is the program without the additional 300+ write to files as commented in the code below. Code: [Select]#include<IOSTREAM> #include<fstream> using namespace std; int main() { ofstream myfile; myfile.open("Config.conf",ios::app); // Over 300 config settings to write to file, with just 2 shown here for example myfile<<"DataDir = \".\"\n"; myfile<<"LogsDir = \"\"\n"; myfile.close(); return(0); } Here is the compiler error I get that I have never run into before. Quote --------------------Configuration: Project1 - Win32 Debug--------------------http://msdn.microsoft.com/en-us/library/aa278580%28v=vs.60%29.aspx Quote Note In most cases, use of this compiler option is not necessary. Use it if compiling your program causes error message C1076: "compiler limit : internal heap limit reached."Thanks again BC I have made large programs before and never ran into this before and assumed that because I know C++, but I am no master of C++, that it might be my technique that was causing this in which I needed to tweak my code to work within the default limits. The link you pointed me to shows me that its a RARE, but known heap size issue and I obviously just needed to increase it. I think the LAST time I had a similar problem it was way back 25+ years ago when I exceeded the 64k limit of GW-Basic when writing a very large video game, that never came to be because the 64k was like hitting a wall. I suppose I could have SHORTENED the game and worked hours on end to make it more efficient (smaller), but I gave up on it when hitting that wall. Never thought I would hit a limit with C++ 6.0, but at least unlike GW-Basic, this limit can be adjusted. Since adjusting this heap memory limit, it now compiles correctly. Many Thanks!!! |
|
30. |
Solve : Scripting language embed in exe? |
Answer» I started WORKING on my scripting language project again, and decided that I want to be able to somehow embed my code with the interpreter and produce a single exe file that can be transferred to any machine without the interpreter. I figured that the way to do this would be using a resource file that contains the code which is read by the interpreter at run time. The problem is that I need to link the resource file. I just realized that the programming language I am using won't produce obj files, only exes. I just realized that the programming language I am using won't produce obj files, only exes.Which one? Quote Is it possible to link a file that is already linked in order to add resources?I don't think so. obj files don't have resources, anyway- those are added by a resource compiler after the fact. Quote Can I add my resources into the exe if it currently doesn't contain any resources? I know there is some winapi function called UpdateResource, but does that only replace already existing resources or can it add new ones?It does both. ref: http://msdn.microsoft.com/en-us/library/ff468902%28v=VS.85%29.aspx Quote because I want to be able to compress with UPXnice. Isn't it awesome being flagged as a trojan by all sorts of AV programs? Here I OFFER a very broad reply, void of specific details. Interpretive language design is a very broad thing. They most widely used interpretive language presently used and widely known, is Java. here are others, but not widely know outside of specific industries. Hard to say which is more important. You just don't see a big business with a poster reading "Jave Inside" on the front windows. The poster could say "MS SQL used here' just as well. Using the model of Java or some of the others, you can create your own interpretive language that is cross-platform. But to include the run-time library and the pseudo-code in one package is not using the design to its full potential. The resulting EXE files are larger that needed. You would wind up with EXE files larger than the run-time package. Historically, this has been done many times.The technique is still used in commercial applications. Especially large data base management systems. An interpretive code is need both for debugging and maintainability of the massive programs used in large systems. They write books about this. Boring books. You might want to learn more about the MS SQL. http://en.wikipedia.org/wiki/Microsoft_SQL_server Quote from: Geek-9pm on June 16, 2011, 12:09:07 AM They most widely used interpretive language presently used and widely known, is Java. here are others, but not widely know outside of specific industries. Hard to say which is more important. You just don't see a big business with a poster reading "Jave Inside" on the front windows. The poster could say "MS SQL used here' just as well. Java is not an interpreted language. The interpreted language is Java bytecode, which is quite a bit different. java isn't the only language compiled to bytecode; two examples I can name of the top of my head that also COMPILE to the Java Virtual Machine are Erlang and Scala. Quote Using the model of Java or some of the others, you can create your own interpretive language that is cross-platform.He already has an interpreted language. He wants to wrap it in an executable form; that is, interpreter + interpreted script in one go. He's not trying to make a virtual machine. Quote But to include the run-time library and the pseudo-code in one package is not using the design to its full potential.What does this have to do with anything? Quote The resulting EXE files are larger that needed. You would wind up with EXE files larger than the run-time package.So you are instead suggesting that he get people to go and download his interpreter? That is exactly the reason he wants to make it this way, so they don't have to take that extra step. Even now, to run Java applications, one needs to install a JVM; to run .NET applications, you need a CLR (although one comes with Vista & 7). His "runtime" (script language interpreter) is not going to be super popular or familiar to people, so it isn't something they are going to have installed. Quote Historically, this has been done many times.The technique is still used in commercial applications. Especially large data base management systems.What are you even talking about now? embedding script code and stored procedures in a database is completely and entirely different from packaging a Interpreter with the interpreted script, and have completely different use cases. Quote An interpretive code is need both for debugging and maintainability of the massive programs used in large systems. They write books about this. Boring books. Somebody asks how to build a tool similar to py2exe for his scripting language implementation.. and you provide a link to the SQL Server Wiki page. I... I cannot fathom what logic hides behind this response. Either way, I just had a thought about the UPX compression/encryption: is it being compressed you modify the resources? because you cannot use the Resource API to fiddle with the resources of a program compressed with most compression formats. (UPX I know is one of them). Best thing to do would be to have the script interpreter program check when it starts for a given resource, and if not found, proceed to act "normally", but if it is, it uses that resource as the script to execute. Then when you want to create a "self-running" executable, you simply make a copy of the interpreter program, and then use the Resource API to add the resource and make it the script you want to execute. Your dedicatory skills really suffers BC. 1,330 Java experts say it is not an interpreted language. 39,400 Other authorities say is is in deed and interpretive language. Go with the majority, unless you are one of those experts. To carry this further, some say Forth is an inoperative language, yet others argue that it is not even a language, just a way for invoking low-level code. Some real-time industrial applications are structures like any as interpretive language, yet they are very low-level primitive systems just a cut above machine code. And yes, virtual machine, at the core concept, are interpretative systems. Quote Many interpreted languages are first compiled to some form of virtual machine code, which is then either interpreted or compiled at run time to native code. If he wants to incorporate his interpreter and his run-time library in on bundle, yes he can do it. If he wants to optimize, it can be made to take very little space and can be a self-extracting file. And he does not have to use .NET or any of that kind of trash. Just a lot of work. He can use an Natural, Organic, pesticide-free, Green, low salt no fat c/C++ compiler from some one other that MS. Did I hear Intel? http://en.wikipedia.org/wiki/Intel_C%2B%2B_Compiler Quote I just realized that the programming language I am using won't produce obj files, only exes.Quote Which one? PB (PowerBasic). Originally I started my project in C, but I stopped half way because it became too cumbersome, and I don't like C syntax. I thought about doing it in VB6, but it's getting old and uses a runtime. I didn't like the idea of making an interpreter in such a high-level language, so I decided on something in between - PowerBasic. The syntax is almost identical to VB, but it compiles to a native exe. So far, I have been liking it, except for two things. It won't produce obj files and it uses a proprietary resource file format (read below). Quote nice. Isn't it awesome being flagged as a trojan by all sorts of AV programs? Are you talking about UPX? If so, can you recommend a exe compressor/encryptor that isn't detected by AV. Quote Historically, this has been done many times.The technique is still used in commercial applications. Especially large data base management systems. An interpretive code is need both for debugging and maintainability of the massive programs used in large systems. GEEK: Are you tired? Quote Best thing to do would be to have the script interpreter program check when it starts for a given resource, and if not found, proceed to act "normally", but if it is, it uses that resource as the script to execute. Then when you want to create a "self-running" executable, you simply make a copy of the interpreter program, and then use the Resource API to add the resource and make it the script you want to execute. That's what I was going to do until I experimented with ResourceHacker and found out that PB uses a different kind of resource file format, so this method won't work. I think I am just going to write the code directly on to the end of the exe file and hope it doesn't trigger any AV software. Quote If he wants to incorporate his interpreter and his run-time library in on bundle, yes he can do it. If he wants to optimize, it can be made to take very little space and can be a self-extracting file. And he does not have to use .NET or any of that kind of trash. Just a lot of work. Yes, that's what I plan on doing. I don't think the size of the runtime will matter because it's only about 100KB right now and it will probably not go above 300KB which is really small compared to most runtimes. As for the suggestion for a compiler, I am already working on the interpreter and don't need to change languages now (I already did once).OK. You are serious. Forget using C. With Power Basic you can don it all. With just a little bit of extra code to 'glue' things together. Once you get on to it, please don't tell how it is done. Some of us make our living keeping these kinds of things secret. You might know what I mean. Use C when you work for a big company. When doing work privately, use secret tools. I got that down about 15 years ago on a critical project that started d a small company. Doing it is C was a big was of time. even with the best C libraries we could get back thing. There were three or four secret tools I had. One was called Framework II. Too bad MS bought it and froze it. Quote from: Geek-9pm on June 16, 2011, 02:45:56 AM Your dedicatory skills really suffers BC.my what? Quote 1,330 Java experts say it is not an interpreted language.*censored*? you can't just plug search queries into google and use those results as some sort of evidence. Nor can you claim that the hits are text being posted by "java experts" so you can stop making stuff up now. Java itself isn't an "interpreted" language, the bytecode is. That may sound like "no difference" but there is a difference. Python/Perl/VBScript/Javascript have to be read, parsed, interpreted and executed On-the-fly; java is compiled to bytecode, and that bytecode is compiled to native machine code as the program runs. is there an interpretation step? Of course there is. But my point is that the way java is run using a Virtual Machine is completely and utterly different from a standard script language and is not something that you create for a portable script language. To run java code, it needs to be compiled. After that point- it's no longer java code- it's bytecode. Therefore java is a compiled language. Perhaps not in the spirit of the definition but that's the way the cards stacked. Quote To carry this further, some say Forth is an inoperative language, yet others argue that it is not even a language, just a way for invoking low-level code. Some real-time industrial applications are structures like any as interpretive language, yet they are very low-level primitive systems just a cut above machine code.What are you talking about? Where the *censored* did Forth come from here? Quote And yes, virtual machine, at the core concept, are interpretative systems.But they are still fundamentally different from Perl, Python, VBScript, etc. And regardless is NOT WHAT THE OP HAS. They aren't asking "how do I implement a Interpreted language". their question wasn't, "hey, I already have a language interpreter I wrote, can somebody make a nonsense post about java and virtual machines that does nothing to answer my actual question regarding the creation of an Executable package for a script file?" Quote If he wants to incorporate his interpreter and his run-time library in on bundle, yes he can do it.Well thank goodness you are here to tell us all what we already know. Quote If he wants to optimize, it can be made to take very little space and can be a self-extracting file.What are you even talking about now. I truly do not know. He never said he wanted to optimize. How a "self-extracting file" would help is beyond me. I honest have no clue what you are rambling about. Quote And he does not have to use .NET or any of that kind of trash. .NET is not trash. You ought to back up your statements with some sort of evidence. Ideally not "evidence" regarding the number of hits you get between ".NET is trash" and ".NET is not trash". Remember to back it up with statements about .NET (the class library) and not the CLR (the runtime); I assume you of course are well aware of the difference, being that you are able to make such blanket statements about the technologies as a whole. points to pay close attention to: Why is it trash? Again: Specifics. none of this "well it does or it doesn't allow me to " either. How would using .NET make this "task" easier? I really don't see how it would. Messing about with embedded resx files would be a *censored* of a lot more difficult than working with the Resource API functions. The only resource a .NET application would normally have are things like icon and version; and possibly typelib if it is a COM wrapper, but I haven't used COM wrappers. needless to say I'm sure you regard COM as trash as well. *censored* anything you don't understand in the slightest must be trash. Quote He can use an Natural, Organic, pesticide-free, Green, low salt no fat c/C++ compiler from some one other that MS. Did I hear Intel? This has absolutely NOTHING TO DO WITH ANYTHING IN THIS THREAD. But I'll address it. What is different between Intel's Compiler and Microsoft's compiler? Specifics please. Pay particular attention to those elements that would make it more natural, Organic, pesticide free, Green, and no fat. Or, perhaps to be precise, why they shouldn't use the MS compiler in favour of it. And also, why the Microsoft C/C++ compiler even enters into this thread since they didn't state what language they used. Why Intel, anyway? Most Anti-Microsoft peeps prefer to use gcc or g++ for C++ (and to be fair it is a fine compiler). Quote It won't produce obj files and it uses a proprietary resource file format (read below).Actually, all windows executables will have a standard resource- you can use the Resource API to add a new entry. however, the difference with PowerBASIC in this case would be that you need to read that Resource using the API as well. (rather than using the built in "resource handling" that it provides. LoadString() might be sufficient for attempting to read the appropriate resource. from the code; adding the resource ought to still be a appropriate set of Resource management functions to update the resource. Quote Are you talking about UPX? If so, can you recommend a exe compressor/encryptor that isn't detected by AV.None that I know of. FWIW I personally find exe compression/encryption utterly pointless and only goes to show ones hubris about their own projects. And this is with PowerBASIC, which if I understand correctly compiles to a Machine code EXE, right? isn't that enough "protection" from... whatever you are encrypting the program for? After all, only you have the original source, anybody else would just have the dissassembly. Quote I personally find exe compression/encryption utterly pointless and only goes to show ones hubris about their own projectsWe can agree on this. Compression/encryption is of little value for a project. Unless compression/encryption is the project. From the OP first post it is not clear if he has and interactive language or one the has to be processed before execution. Many compiled languages have other forms, even interactive interpreters. You keep using the term 'byte code'. Would you like to explain that? Some machines have a 12 bit word. Quote from: Geek-9pm on June 16, 2011, 11:14:03 AM
http://en.wikipedia.org/wiki/Java_bytecode Quote from: BC_Programmer on June 16, 2011, 02:38:44 PM http://en.wikipedia.org/wiki/Java_bytecodeThank you. That is informative and contains material that not all readers already know. Such as: Quote Java bytecode is the form of instructions that the Java virtual machine executes. Each bytecode opcode is one byte in length, although some require parameters, resulting in some multi-byte instructions. Not all of the possible 256 opcodes are used. In fact, Sun Microsystems, the original creators of the Java programming language, the Java virtual machine and other components of the Java Runtime Environment (JRE), have set aside 3 values to be permanently unimplemented.[1Where did the OP go? Having a cup of coffee? Quote from: Geek-9pm on June 16, 2011, 02:45:56 AM Your dedicatory skills really suffers BC. What does this mean? Quote from: Salmon Trout on June 16, 2011, 03:17:13 PM What does this mean?Intended here as a form of dry sarcasm. It refers to the skill of raising or elevating a literary or musical work to a higher level of unselfish inspiration by dedicating the work to another person or Deity or esteemed principal. Sometimes used by authors as a shield to hide pride and arrogance. "My amazing hyper-drive theory book is dedicated to the memory my dear sweet aunt Martha, who used to instill in me the desire to reach for the stats." Quote which if I understand correctly compiles to a Machine code EXE, right? isn't that enough "protection" from... whatever you are encrypting the program for? The reason I want to encrypt it, is not to protect from disassembling the interpreter, but from reading the script contained within the exe. In all other instances though, yes, I do believe that encrypters/compressors are not necessary. Quote We can agree on this. Compression/encryption is of little value for a project. Unless compression/encryption is the project. Or if there is a script inside the exe. Quote From the OP first post it is not clear if he has and interactive language or one the has to be processed before execution. No, there is no processing before execution in my language, aside from tokenizing the syntax. It's pretty simple. Just a major switch statement to process the commands and some modules which contain the functions. Currently, it has no debugging or error handling. I don't want to spend too much time writing all the error messages that it would require. This is not something that I am doing for business, just a hobby. The language is like a mixture of BASIC and batch. The idea behind it is to make a language that is like batch, but also has access to API functions. Like AutoIT. Quote Where did the OP go? Having a cup of coffee? Sleep. Just incase you missed this earlier: Quote That's what I was going to do until I experimented with ResourceHacker and found out that PB uses a different kind of resource file format, so this method won't work. I think I am just going to write the code directly on to the end of the exe file and hope it doesn't trigger any AV software. I used resource hacker and also tried the resource API functions that you posted earlier. No go, they both corrupt the exe. So that's how I arrived at the conclusion that PowerBASIC uses a different resource format. I could be wrong, but I think investigating that would be hard.Incase you are interested, here is my first test script: Code: [Select]define:value: count define:value: i define:text: thing SetValue count 5 Out Type something: $ In thing ->Repeat [value] count + i Out You typed: [text] thing [value] i $ <- Output: Code: [Select]Type something: bla bla You typed:bla bla1 You typed:bla bla2 You typed:bla bla3 You typed:bla bla4 You typed:bla bla5 |
|
31. |
Solve : VB .NET Web/ASP - Send info to all clients? |
Answer» I am MAKING an online chatroom with VB.NET/ASP. The only thing I can't figure out is how to take the INPUT from one user and send it to all clients. Please help. |
|
32. |
Solve : program control in C programming? |
Answer» hey! i got a PROBLEM with understand this program. |
|
33. |
Solve : Flowchart help needed.? |
Answer» Im looking for someone to help me with flowcharting. thx. im a little familiar of the structure of it ... that is, you want somebody to do your homework for you. Look at a flow chart and see what kinds of things are in the boxes and try to relate them to the things your program NEEDS to do. go to google. Search for flow chart. Click on images to search images. Your homework has been completed for you except for the actual text. |
|
34. |
Solve : CSS help, please?? |
Answer» Bet you didn't expect to HEAR from me, did ya? |
|
35. |
Solve : Converting Binary Numbers to Decimals and Converting Hexadecimals? |
Answer» Hello, |
|
36. |
Solve : Free Assemblers and Tools? |
Answer» Don't pay money for assembly language tools. Some of the best are free. Anyone who might want to try Assembly Language programming can find free tools. Free AssemblersAnybody can learn Assembler as FIST computer language. No previous skills needed. (Ability ton read is needed.)I've done a little assembly. Ability to spell correctly is also needed. Quote from: rthompson80819 on April 28, 2011, 05:49:36 PM I've done a little assembly.That's true, but I have been able to manage. The smallest and simplest x86 assembler http://flatassembler.net/ It is used to make OSs, so yeah. It's pretty stable. A good IDE: http://www.winasm.net/Linux711, thanks for adding to this thread. Hopefully we can interest OTHERS in learning Assembler and other low-level languages. The flat assembler has versions for DOS, Linux and Windows. Quote from: Linux711 on May 01, 2011, 09:34:36 PM The smallest and simplest x86 assembleri am general PROGRAMMER , familiar with c and JAVA , totally unaware of asm , will it help me to learn asm ? Quote will it help me to learn asm ? There is a PDF that comes with flat assembler that teaches you the fundamentals of assembly langauge programming. More: http://win32assembly.online.fr/tutorials.htmli forgot to mention , am using ubuntu as OS will it help me on it ? Quote am using ubuntu as OS will it help me on it ? Quote The flat assembler has versions for DOS, Linux and Windows.thanx bro , i want some help on installation of fasm compiler on ubuntu .The fifth post on this page might help: http://ubuntuforums.org/showthread.php?t=1072803Some thoughts:
Assembly is better in Linux, easier, more powerful and you work in protected mode. Forget that 16 bit DOS environment. sorry to reply to old topic, but anybody know how well ideone.com is? Appears to be an all-in-one IDE allowing you to run whatever programming language's code you wish to run, assuming it's one of their listed programming languages supported. You should start a new thread. If you had started a new thread I would have recommended: http://kate-editor.org/ |
|
37. |
Solve : C++0x? |
Answer» I would LIKE to KNOW what's your opinion on the new standard, C++0x ? C++0xIMHO : Rather overdue. Could use a better name.http://www2.research.att.com/~bs/C++0xFAQ.html |
|
38. |
Solve : How can I search a text on a special drive? |
Answer» Dear all |
|
39. |
Solve : Batch chat? |
Answer» Hello! I'm making a simple batch program, that will take input, put it in a file, and display it just LIKE a chat. Hello! I'm making a simple batch program, that will take input, put it in a file, and display it just like a chat.Now can we ask why? Batch files were intended to solve basic jobs common to MS-DOS about 20 years ago. And 20 years ago doing a chat in batch was, even then, considered poor use of resources. If this was intended as a prank, it would be contrary to the forum rules to help you. I'd like to learn more. That's my only reason. I do understand that batch is made for simpler tasks and such, but I'd like to know how to do as many things as possible. This is no prank/joke, and it would be great to know how to make a simple batch chat. Even though it would be on a LAN network. It would teach me how to upload/write/read to/from a network. And besides, if you say it's poor use of resources, does that mean there IS an easy way to do this? if there is, Please tell me how! Quote from: Radiation G0D on July 24, 2011, 11:26:52 AM And besides, if you say it's poor use of resources, does that mean there IS an easy way to do this? if there is, Please tell me how! Use a more full-featured language, Like Visual Basic, C, Python, C++, C#, F#, Perl, etc.There are many, many chat things written in Perl. Start here: http://cgi.resourceindex.com/Programs_and_Scripts/Perl/Chat/ The best LEARNING experience for most people comes after looking at the example of others who have done well.Might be so, but I'm asking for help with a BATCH chat, and not Perl. Or any other programming language. (Except for VBScript ) |
|
40. |
Solve : C++ API? |
Answer» Hey guys, You cannot change this attribute if the window does not belong to the same process as the calling thread. This means the only way to actually subclass another processes window would be DLL injection, or, using a appinit_dll, or otherwise having a dll that is loaded in that process, and making the appropriate subclassing calls from that dll (since it is in the same process, it will work). The general approach for doing this usually involves injecting your DLL into the other process by using CreateRemoteThread(), and creating a remote thread in the other process that loads your DLL by passing as the start address the address of the WIN32 LoadLibrary() function, with the path to the DLL to load as a parameter. This in and of itself has a few PROBLEMS; mainly, that while the address of LoadLibrary() will be the same cross-process (all processes load kernel32.dll) the same cannot be said of the string specifying the path, which will be a pointer that is only valid in your address space. The solution to this is to make that pointer valid in the remote process by using WriteProcessMemory() to make the pointer valid. Basically, in order to subclass another processes windows, you'll need to be "in the process" so to speak. In order to inject your DLL, you would need to first get a HANDLE to the remote process (using OpenProcess()). Take note that this will fail in many cases as a result of SECURITY settings and the account; settings, because you need to have the "Query Process" permissions on the account your program is running in, which you won't have by default. You will then need to allocate memory for the DLL name in the remote process using that HANDLE by calling VirtualAllocEx, and then write that DLL name using WriteProcessMemory(); once that is done, you can map your DLL to the remote process by using CreateRemoteThread() and making it call LoadLibrary() as the start routine and with your DLL's name as the thread start parameter. At this POINT you would wait for the remote thread to terminate (using WaitForSingleObject, usually). LoadLibrary() will load your DLL and call it's DllMain() with DLL_PROCESS_ATTACH as the reason. Once finished, you can use GetExitCodeThread() on the remote thread, which will retrieve the return code from LoadLibrary, which will be the base address of your DLL within the other process. At this point your DLL can do whatever it PLEASES, including subclassing windows within the process is was spawned in. Basically, it's not really worth the effort, and you will usually have to resort to actual Window Hooks to get everything working nicely. Thanks BC, you have saved me alot of mindless googling as you said its probably not worth the effort but ill take a look into windows hooks and DLL injection |
|
41. |
Solve : Visual C++ 2008 - GUI user input and write appending to text file? |
Answer» So I am making the transition from VC6 to VC++ 2008 Express and went looking for an example to look at on how to take a user input in Windows GUI that is a char string and write that appending to a text FILE and no such luck, but tons of info on how to do this in Console dos shell mode for user input and write to file which I already know how to do. Kind of wish the college professor back then went into the Visual C++ instead of Console C++There is no "Visual C++" or "Console C++" language; Visual C++ is the name of the C++ IDE MICROSOFT produced some years ago for working with the Win32 API. The "Visual" portion has been largely untrue, really. Creating a GUI in C++ using the Win32 API takes, quite literally, several pages of C code; this isn't something any class can really teach, especially since Programming classes/courses are there to teach the programming concepts using the language, not how to use a specific library (like the win32 API). Console input/output usually only amounts to learning a few basic functions, rather than having to learn an entire library if windows messages and callback function names and headers, so focus can be kept on syntax and semantics. Quote A while back when looking into Windows GUI programming many people told me to switch to Visual Basic which is easier than Visual C++, but I was stubborn and stuck with C++. Should I make the transition from C++ to VB? Probably couldnt hurt to know both anyways?If you want to work with .NET, I would personally recommend C#.. but, that could be rather BIASSED, since that is now my language of choice , but also since you will be more familiar with much of the syntax and semantics(with the exception that you cannot use multiple inheritance). Visual Basic .NET however would work just as well. C++/CLI works, but it has a lot of disadvantages; mostly in that the IDE's intellisense support for C++ blows. And you can't force it to show like you could in VC6 pressing Control-Alt-T, from what I can tell. Also, the windows forms Designers sometimes act a bit weird when used with a C++ project. I'd recommend giving them each a fair go though at some point. (C#,C++/CLI,VB.NET). Maybe even try a Win32 project; just make sure you've got a fair handle on callback functions and function pointers and whatnot. Thanks BC! Will post back if i have any problems. |
|
42. |
Solve : How to Insert Unicode font in Access? |
Answer» HELLO, I've a problem.It's how to INSERT unicode font in ACCESS DATABASE(MS.Access 2003).Unicode font is Myanmar Unicode. Thanks. |
|
43. |
Solve : C++/API input to notepad.exe? |
Answer» HEY Guys, I'm new to API and basically want to know how to handle a process and send text to it. I.E. start notepad.exe handle notepad.exe send message "hello world" to handle destroy handle return "success" i would like "hello world' to be printed while notepad is OPEN so if i added sleep 2 seconds between each char i would see it slowly typing ... = sleep 2 seconds h...e...l...l .......etc is this possible? Thanks in advance. Here is what you need to do: Get the handle of the notepad window Use FindWindowEx to LOCATE the edit control Then use SendMessage with WM_SETTEXT to put the text into the textbox The last post here (it's VB, but you can get an idea): http://www.vbforums.com/showthread.php?t=539565Thanks Linux, i still have no idea where to start. Any chance you could post the complete code so that i can copy paste it and modify... i learn best this wayI SOLVED this on my own here is the code for anyone who wants Code: [Select]string s = "hello world" hwnd = FindWindow(NULL, "Untitled - Notepad"); hwndChild = FindWindowEx(hwnd, NULL, "EDIT", NULL); SendMessage(hwndChild, WM_SETTEXT, NULL, (LPARAM)s.c_str()); |
|
44. |
Solve : How to get into/install interactive mode in python? |
Answer» How to get into/install interactive mode in python. I have installed python on my windows xp system but I cant seem to find interactive mode.Just start it up. It should be in you program list. When is starts you MAY see this: |
|
45. |
Solve : Issue with Seeded Random Generators C++? |
Answer» I have a program that I am tinkering on and it has 8 seeded random generators. I am trying to fix 2 problems. Thanks for the information BC and Salmon, also I wasnt aware of the random generator online at random.org thats neat. According to the site, it's based on atmospheric aberrations. You should NOT seed a random number generator multiple times in a run. It reduces the entropy of the results, it doesn't increase them. |
|
46. |
Solve : Delphi Parts? |
Answer» I'm trying to make a particle system in delphi/pascal and i don't know how i should present them like display the particles... I have properties to make the particles but do i use DRAW or run a image as a template and use an array to be each individual particle and then have the particles move via a timer..? The problem with this is that the more instances that their are the timer can't handle it cause it is trying to process to much at once and gives a lagging seeming effect. Does any one know how i could draw the particles on the form and have them controlled through some means? |
|
47. |
Solve : python help? |
Answer» Hello. Hmmm. Last week it was Java, this week it's Python. I have risen to my level of incompetence. x=="" is one way... but here's a more "Pythonic" one , whatever that means Code: [Select].... if not x: .... |
|
48. |
Solve : Problem in installing Software - May be Windows Xp or Vista Issue? |
Answer» 1 . In wrote a GAME in Visual basic Express 2008 - and it works perfectly - all of the time. (Window Xp was on that machine) |
|
49. |
Solve : Problem with DevC++? |
Answer» Have a f***in' problem with DEVC++. I cannot USE Debug . Does anyone have an idea how can I fix this...? You need your source code to be included in a PROJECT (*.dev) for Debug to work.Why dont u get Visual Studio 2005? |
|
50. |
Solve : Help with assembly? |
Answer» I'm MAKING an os, and, to SPEED up the proces of printing CHARS, can i do this for an example : "mov al,'C'" instead of: "mov al,0x43" also, how can i change the BACKGROUND COLOR? |
|