Explore topic-wise InterviewSolutions in .

This section includes InterviewSolutions, each offering curated multiple-choice questions to sharpen your knowledge and support exam preparation. Choose a topic below to get started.

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"

Drop a text file onto it and it should create a file called "Download.csv" in the same folder as the file that you dropped.

The input file should correspond to the format of your "source.txt"

The output file will (I hope) correspond to your "download.csv"

Please advise of progress.

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
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 without trailing comma
    outPutLine=OutputLine & Chr(34) & arrFields(77) & Chr(34)
    Writefile.writeline outPutLine
Next
Writefile.Close
wscript.echo "Download.csv written - processing completed"
Wow it is so nearly there
But I got this error when I imported the download file:
"Import failed because the file does not have delimited first line"

So I added a comma to the end of the first (header) line in download.csv and tried importing it again and it worked !!
If you can change that you have it sorted !!
thanksGood Job Salmon Trout. Definitely needed vbscript to handle the comma issue.

I have an old bactch file that kind of dealed with that issue. It would count the delimiters in the line before processing the line. If it had to many it would just kick that line out to an error file to be manually fixed first. Quote from: nqtraderman on January 01, 2012, 03:14:51 PM

"Import failed because the file does not have delimited first line"

So I added a comma to the end of the first (header) line in download.csv and tried importing it again and it worked !!

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...
 romeonehmia.......  Do you have a functioning floppy drive or a working cd-rom .......  You should be ABLE to run your virus scans from there ........

let us know

dl65   Quote

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.

The default settings for a form are to make it sizable. Reverse what you did to make it not sizable.

 cool, thanks.

4.

Solve : Python - Writing Text To File??

Answer»

How can I print something to a new FILE USING python?
I want to TAKE variables a, B, and C and print them to a text file.
Also, how to append if I want to add more?give this a look.

Python docs: http://docs.python.org/tutorial/inputoutput.html

Specifically, part 7.2

Here's another tutorial as well:
http://www.penzilla.net/tutorials/python/fileio/

A great free Python Learning Book for all ages despite its title.
http://www.briggs.net.nz/log/writing/snake-wrangling-for-kids/ Quote from: Squashman on January 19, 2012, 07:35:27 AM

A great free Python Learning Book for all ages despite its title.
http://www.briggs.net.nz/log/writing/snake-wrangling-for-kids/

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) ??
JB is FREE, but unfortunately LB is not. You can FIND out more at my forum: http://jb.netfast.org
Come along and see what ur missing. Also has forums for VB (empty at the mo) and C++ (very few posts). You can follow the links for JB and LB downloads there.

See you there!

jcarr

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....

this should work:

http://www.internetnews.com/dev-news/article.php/3636081

 Page not found.Works for me. Quote

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
      div = 0
      .MoveFirst
       Do Until .EOF
             mytotal = mytotal + (rs!b_total * rs!exchrate)
             div = div + 1
             .MoveNext
        Loop
           
        mytotal = mytotal / div
        Range("A15").Value = mytotal
This is what I use to add the product of 'b_total' and 'exchrate' in a recordset...  Just need to know how to get ADO to IDENTIFY and add up the rows with the SAME jobno. Thanks in advance! The SQL statement that FETCHED this record SET should be ABLE to do the calculations for you. Make sure you GROUP BY jobno and you use AVG of b_total multiplied by exchrate.

Good luck.

9.

Solve : programming Clarion?

Answer»

Clarion 6 ABC.

Is there any POSSIBILITY to run EIP manager over the queue loaded list box.
If EIP manager coud only be USED with browse manager, is it possible to make browse manager over the queue, but not over the table from dictionary.

Tanks a lot.You'll probably get a better response by posting on one of the Clarion forums.  A few are listed here

GOOD LUCK.

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.
I also have this in a resource file(Images.rc):
TEXTBMP BITMAP "image/TEXT.bmp" (the file TEXT.bmp is in directory "image" which is in the current directory of the program)

In my "Main.c" file I use the FUNCTION "LoadBitmap" (hThisInstance is the current instance of the program" :
LoadBitmap(hThisInstance, "TEXTBMP");
After that I have one if OPERATOR which TELLS me if the resource cannot be loaded.

Finaly when I compile it appears the MessageBox that tells me "Load Of Resources FAILED."  So Why the resources in Images.rc can't be loaded?

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 &LT;= 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

You use your hands to type. 

Googled in about 2 seconds....THANKS!

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.

Text file "Template A" , line 5, uses line one from text file "B", then saves the file as 1.txt.

Then Text file "Template A" , line 5, uses line two from text file "B", then saves the file as 2.txt.

It does this for all 500 lines in text file "B", so after it's done there is 500 text files.

Here is my template:

Code: [Select]loadplugin("C:\Program Files (x86)\AviSynth 2.5\plugins\DirectShowSource.dll")

directshowsource("C:\Users\Jeremy\Desktop\D H.avi", audio=false, 23.976)

trim(0, 93)

converttoyv12()

Here is the trim list I want to use in the template:

Code: [Select] trim(94,153)
 trim(154,197)
 trim(198,249)
 trim(250,287)
 trim(288,331)
 trim(332,398)
 trim(399,420)
 trim(421,467)
 trim(468,485)
 trim(486,512)
 trim(513,526)
 trim(527,540)
 trim(541,592)
 trim(593,633)
 trim(634,653)
 trim(654,688)
 trim(689,714)
 trim(715,787)
 trim(788,848)
 trim(849,880)
 trim(881,925)
 trim(926,942)
 trim(943,966)
 trim(967,975)
 trim(976,995)
 trim(996,1012)
 trim(1013,1027)
 trim(1028,1036)
 trim(1037,1055)
 trim(1056,1075)
 trim(1076,1150)

So the final template has this new trim value:

Code: [Select][code]
loadplugin("C:\Program Files (x86)\AviSynth 2.5\plugins\DirectShowSource.dll")

directshowsource("C:\Users\Jeremy\Desktop\D H.avi", audio=false, 23.976)

trim(94,153)

converttoyv12()
[/code]I found this bat file:

Code: [Select]echo off
setlocal enabledelayedexpansion

Rem ===================================================================
Rem Batch for inserting a line into every AVS file in a specific
Rem directory
Rem
Rem Usage: insline [directory] [text] [line number]
Rem
Rem Make sure to use quotes around directory and text.
Rem
Rem Example: insline "d:\rebuild\d2vavs" "undot().deen()" 2
Rem
Rem          Recursively scans directory d:\rebuild\d2vavs for .AVS
Rem          files and inserts undot().deen() at line number 2 into
Rem          every .AVS. -1 for line number appends at end of file.
Rem ===================================================================
if "%~1" == "" goto :EOF
if "%~2" == "" goto :EOF
if "%~3" == "" goto :EOF
if not EXIST "%~1" goto :EOF

set text=%~2
for /R "%~1" %%F in (*.avs) do (
  set line=0
  if "%~3" == "-1" (
    echo !text!>>"%%F"
  ) else (
    if exist "%%~dpnF.$$$" del "%%~dpnF.$$$"
    for /F "usebackq delims=" %%I in ("%%F") do for /F "tokens=1 delims= " %%J in ("%%I") do (
      set char=%%J
      set char=!char:~0,1!
      if not "!char!" == "#" (
        set /A "line += 1"
        if "!line!" == "%~3" echo !text!>>"%%~dpnF.$$$"
      )
      echo %%I>>"%%~dpnF.$$$"
    )
    del "%%F"
    ren "%%~dpnF.$$$" "%%~nxF"
  )
)

But I don't know how to use it. Could somebody here post to show how? Quote from: Jerry_s on May 06, 2011, 08:04:17 PM

Here is the trim list I want to use in the template:

Code: [Select] trim(94,153)
 trim(154,197)
 trim(198,249)
 trim(250,287)
 trim(288,331)
 trim(332,398)
 trim(399,420)
 trim(421,467)
 trim(468,485)
 trim(486,512)
 trim(513,526)
 trim(527,540)
 trim(541,592)
 trim(593,633)
 trim(634,653)
 trim(654,688)
 trim(689,714)
 trim(715,787)
 trim(788,848)
 trim(849,880)
 trim(881,925)
 trim(926,942)
 trim(943,966)
 trim(967,975)
 trim(976,995)
 trim(996,1012)
 trim(1013,1027)
 trim(1028,1036)
 trim(1037,1055)
 trim(1056,1075)
 trim(1076,1150)

So the final template has this new trim value:

Code: [Select][code]
loadplugin("C:\Program Files (x86)\AviSynth 2.5\plugins\DirectShowSource.dll")

directshowsource("C:\Users\Jeremy\Desktop\D H.avi", audio=false, 23.976)

trim(94,153)

converttoyv12()

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 &AMP; 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,

I am trying to store permutations (huge) in an int and it limits itself so i was HOPING there was another way of doing this.

for INSTANCE if i want to store a value > 4,294,967,295 in an unsigned int it doesnt work when going past that value

so i moved up to unsigned _int64 which allows 18,446,744,073,709,551,615 but as you may know with permutations you can really have limits if your trying to reach a PERFECT program.

for those that dont know permutations = pow(n, r) and when your working with things like 13 to the power of 300 = error on all calculators + comps ive tried it on.

so pretty much IM trying to store a value in an int that has an UNLIMITED size, any ideas?

Thanks in advance
https://mattmccutchen.net/bigint/OMG, BC this is excatly what i was looking for! thank you soooo much

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.

In my example, I have folder filled with .PDF files.  Every so often, a .TIFF or .DOC file etc. will get mixed into it, and I don't want them there.  How would I GO about selecting all files EXCEPT .PDF files and move them to another folder? Quote from: mechaflash on May 13, 2011, 11:57:38 AM

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 have been converting a bunch of my movies to digital, ( which is legal as long as you own and keep the original movies ) and having a video player that could mix it up would be cool. Sort of like a private channel of your own that plays only stuff you like without commercials.. Which is sort of like iTunes play lists of your private radio station sort of   

Cant wait to have my own X Files play list that can randomize, so i dont know what will play next from the many seasons episodes and it would be like my own private X Files channel 

Would be neat to get something like this working on my HTPC that I built so i can shut off the cable bill and no more commercialsI'd like to see a media player that didn't use libraries and used the file system, like windows explorer does.  I'm quite sick and tired of sorting through playlists and playing about with libraries.  Not to mention that this would make copying songs to your MP3 Player a lot easier or putting it on removable memory an easy job, something long-awaited.

People also like easy access to editing ID3 tags (the ones that store things like artist name, song name, track number, genre and stuff you can see in Windows Movie Player and ITunes).

Don't forget that playing AND writing to CDs is paramount, no good media player would be good without being able to create your own CD mixes.

And if possible, get DVD support and maybe even Blu-Ray support in.

And people are going to have to pay for your software or it will need ads, because you'll need to pay licensing fees for use of MP3 decoders, CD decoders, DVD decoders and Blu-Ray decoders.  If possible go for adverts, there aren't enough good free players around and even if it didn't play DVDs and Blu-Rays I'd use it for filling my other requirements, because that would be a kick-*censored* media player in its own right.

I suppose the BEST idea, though, is to keep it simple.  As simple as possible.  Even if it looks boring simple, people will recognise the usefulness of being simple AND easy to use.thanks guys i really do apprecieate your replies and inputs..

DaveLembke

i was planning on including the use of a-z/randomizing...

also, how exactly did u get your htpc set up and stuff..
wat system is it running?

Veltas

if i was to give the option of the use of libraryies or file system as u have stated... would you FEEL as though that would work for you and others who do want to use libraries?

also i was planning to give the avaliable for writting to cds/dvds as .cda files and as the original files (eg - .mp3/.mp4/.flv/  etc)


thanks again guys...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.

I built this up cheaply with pieces and parts, initially to convince my wife about the benefits of it, to sell her on the idea of a Home Theater System. Now she loves it and so i am going to invest money into a better CPU and GPU setup that has HDMI video card, although if I want HD capturing, I am going to have to invest in a newer capture card. I am thinking the capture card I have now is probably maybe 360p given its age. Also going to replace the cheap 2.1 audio with something better.

The HTML local web page type interface is not very fancy, but it allows for you to sit back with wireless keyboard and touch pad from couch and select presets that are hyperlinked in tables etc to online movies and streaming stations etc, as well as select a movie from the list for Windows Media Player to play up and then full-screen it. Was thinking of programming up a nicer interface, but dont have the time to program and HTML is quick and works.

My 6 year old daughter also has fallen in love with this system and the ability to play free online games at nickelodeon etc, so it also serves sort of like a FREE Nintendo system..lolI enjoy VLC and if I were to say what I like the list MIGHT be, simply, the
differences between it and MS Mediaplayer.

http://www.videolan.org/vlc/


The main things I use is the forward and backward jump(s) where
Ctl-L is 3 sec back, Alt-Ctl -Left is 10 sec back.  The keys are selectable
with 4 or 5 sets for 3, 10, 30, 60 and 300 seconds (selectable) jump times.
When I'm learning somethign from a video these really help me.

I think, for me, the intuative aspect of any software is super important.
VLC uses  the space bar to stop and start. 

WinAmp uses the X key to stop and rewind and C key ( I think) to stop.  That
doesn't make intuative sense to me.

Another feature in VLC I like is the settable vol control steps. So every jump is
whatever I set like +1 volume unit or 4 or 10 or 20 and the total scale is 100.
So 100 clicks or 25 clicks can take me to max.

VLC probably has source codes because, I think, it's open source.  I hope you'll
take a look at them .. it can be improved! : )

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. Quote

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.

I built this up cheaply with pieces and parts, initially to convince my wife about the benefits of it, to sell her on the idea of a Home Theater System. Now she loves it and so i am going to invest money into a better CPU and GPU setup that has HDMI video card, although if I want HD capturing, I am going to have to invest in a newer capture card. I am thinking the capture card I have now is probably maybe 360p given its age. Also going to replace the cheap 2.1 audio with something better.

The HTML local web page type interface is not very fancy, but it allows for you to sit back with wireless keyboard and touch pad from couch and select presets that are hyperlinked in tables etc to online movies and streaming stations etc, as well as select a movie from the list for Windows Media Player to play up and then full-screen it. Was thinking of programming up a nicer interface, but dont have the time to program and HTML is quick and works.

My 6 year old daughter also has fallen in love with this system and the ability to play free online games at nickelodeon etc, so it also serves sort of like a FREE Nintendo system..lol

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!

Things in programming make my head spin and i like to take info nice and slow, so my mind doesn't combust.try STUDYING c\c++, machine code, windows powershell, vb... these are basic tools you'll need... then move on to dynamic link librarys, multi threading and api.

i want to learn more API because it allows you to use computer clusters to calculate, if you have millions of calculations it will take forever to run on a home PC and a supercomputer thats $200,000 seems unreasonable. instead you link up all your computers and home and get them to simaltaneously calculate your code...

enjoy and look me up when your rich :p Quote from: Khasiar on April 17, 2011, 11:28:28 PM

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!

Things in programming make my head spin and i like to take info nice and slow, so my mind doesn't combust.

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 Science
CS655: Programming Languages, Spring 2001

How do we tell truths that might hurt?
Edsger W.Dijkstra, 18 June 1975

http://www.cs.virginia.edu/~evans/cs655/readings/ewd498.html
Looking at part of the essay, he also wrote back in 1975:
Quote
...
# FORTRAN --"the infantile disorder"--, by now nearly 20 years old, is hopelessly inadequate for whatever computer application you have in mind today: it is now too clumsy, too risky, and too expensive to use.
# PL/I --"the fatal disease"-- belongs more to the problem set than to the solution set.
# 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.
# The use of COBOL cripples the mind; its teaching should, therefore, be regarded as a criminal offence.
# APL is a mistake, carried through to perfection. It is the language of the future for the programming techniques of the past: it creates a new generation of coding bums.
...
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 PM
    This once famous Dutchman died in 2002.
Er, he's still famous, actually.
Yes, 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 insults
There 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 &AMP; 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 oddities
I 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,

I am currently trying to figure out how to set a variable as a string, write to it, and DISPLAY it on command. I realize this will mosty likely involve an array, however I seem to be getting lost in the headers. Whenever I try to compile I get the following error.  Code: [Select]test_1.cpp(18): error C2872: 'string' : ambiguous symbol If I remove the line Code: [Select]using namespace std; and add std:: in front of all the cins and couts then it will work. So my question is, how can I achieve this without having to remove the namespace std, and without having to add std:: in front of the iostreams. Here is my source:

Code: [Select]
#include "stdafx.h"
#include <iostream&GT;

//which header is for strings?!
#include <fstream>
#include <xstring>

using namespace std;

char string[50];


int main()
{
cout << "Hello you crazy world.\n";
cin >>string[50];

cout<<"Your full name is "<<string[50]<<"\n";

system("pause");


return 0;
}

I have also tried removing the headers I have shown in my source, one by one, to no avail.

Thanks in advance. I will gladly supply more information if I was too vague in my explanation. the string class is defined in "string.h". Also note that the string headers do nothing for "psuedo" strings, (or char arrays). the proper "C++" way would be:


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


void main()
{
        int tempkey;
string* getstring = new string("");

cin >> *getstring;
cout << *getstring;
free(getstring);

cout << "complete. Press Ctrl-Z to exit.";

cin >> tempkey;


}


Using STANDARD C code to get data into a char array is possible as WELL:

Code: [Select]#include <STDLIB>
void main()
{
char* grabstring;
grabstring = (char*)malloc(50);
gets(grabstring);
printf("%s",grabstring);

free(grabstring);
}

your main problem is from naming a variable "string" which undoubtedly conflicts with a "string" type defined elsewhere (such as the include which goes unused alongside fstream). Also you are using cin and directing the input directly to the last element of the array, so unless the user only enters a single character, you will get a buffer overflow.I was able to achieve this with the following code:

Code: [Select]
#include "stdafx.h"
#include <iostream>
#include <string>

using namespace std;

string name ="";


int main()
{

   cout << "Please enter your name.\n";

   cin >> name;

   cout << "Your name is "<< name << endl;

   system("PAUSE");

return 0;

}

Thanks anyhow, I would have tried your suggestions but I am not familiar enough with the language yet for those functions. In time....

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,
I am TRYING to IMPLEMENT a SMALL commander and I have a problem with jlist or SCROLLPANE. I have two jlists embedded in two scrollpanes and I need to see which jlist I clicked on. I need this for the back and forward buttons. THANKS a lot.

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 it
Plenty 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
From Wikipedia, the free encyclopedia
Programming language

A programming language is an artificial language designed to express computations that can be performed by a machine, particularly a computer. Programming languages can be used to create programs that control the behavior of a machine and/or to express algorithms precisely.

The earliest programming languages predate the invention of the computer, and were used to direct the behavior of machines such as Jacquard looms and player pianos. Thousands of different programming languages have been created, mainly in the computer field, with many more being created every year. Most programming languages describe computation in an imperative style, i.e., as a sequence of commands, ALTHOUGH some languages, such as those that support functional programming or logic programming, use alternative forms of description.
http://en.wikipedia.org/wiki/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,

I have 2 questions

1)I want to WRITE a script that saves different INPUT Data from Database into one txt File.

I tried this way:
echo export to a.txt of del MODIFIED by nochardel coldel^; select from DB1>> %SqlFile%
echo export to b.txt of del modified by nochardel coldel^; select from db2>> %SqlFile%
copy a.txt+b.txt d.txt>> %SqlFile%
echo export to d.txt>> %SqlFile%
The porblem of this script is that a.txt and b.txt are not COPIED direct into d.txt but after a second RUN.

Can somebody tell me if there is one other way to reach my GOAL.
Import Rows from DB1 and DB2 and write them into a txt File

2) Is there a possibility to save the .txt file directly in Unix Format.
echo export to d.txt>> %SqlFile%


Thank you in advance,

Erion.

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,

IVE created a C++ program that takes a string and searches a .txt file and opens its location. i have also created a key in the registry
which allows me to open 'run' and type folder and it will execute my program, the same way iexplore, OUTLOOK and winword works.
this is in location

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\folder.exe

The above work fine but i would like to input using the run command as well i.e

folder food

which im hoping will open folder.exe and input and execute string food the same way that when you type iexplore test search it opens the internet and searches 'test search'

im thinking i either need to add another REG key or change my program to sniff input when call both of which i have no clue how to do so any help would be greatly appreciated.

Thanks in advance,
KhasIf your program is located in your system folder or in your PATH variable, then you should be able to type "folder whatever" and the parameters will be successfully passed to the program. I don't get why you're changing registry values. You shouldn't have to do that.I didnt know you COULD just save it in the system folder that saves time... But passing the parameters not working. do i need to change my code to accept it ie


int main (string &parameter){

}//main

??

C++ main routine has to be

Code: [Select]int main(int argc, char *argv[])
to accept commandline arguments. How are you doing it now? You can also use the WIN32 API GetCommandLine() function but it's rather SILLY to include windows.h for something you can get for free.

Thanks BC this has worked!

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.

Below is quick example code similar to what I am using.



Code: [Select]#include <IOSTREAM>
#include <fstream>
using namespace STD;

int main () {
  ofstream myfile;
  myfile.open ("config.conf", ios::app);
  myfile << " "." \n";
  myfile.close();
  return 0;
}Maybe if you had typed "C++ quotes in string" into Google you would have had better luck...

MODIFYING a character in a string from its normal meaning is called "escaping" and is done in many languages by preceding the character you want to modify by an "escape character". The escape character in Java,  Perl, Python, C and C++ is a backslash. In these languages there are two escape styles.

1. More usual, I think, you put the backslash before the character you want to modify.

printf("Dave Lembke said \"I want quotes in a string\" string.\n");

2. Another way is to use a backslash, a lowercase 'x' and the ASCII code (in hex) of the character (omitting the character itself thus...

printf("Dave Lembke said \x22I want quotes in a string\x22 string.\n");

This will only work in an ASCII environment.




Sorry, hasty editing made those examples get the word "string" twice... this looks a bit better...

printf("Dave Lembke said \"I want quotes in a string\" in his post today.\n");

printf("Dave Lembke said \x22I want quotes in a string\x22 in his post today.\n");

So try this in your code

myfile << " \".\" \n";

Thanks Salmon that fixed it. For some reason I was thinking it was Quote

'
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.

I am guessing that it may be because I am executing a secondary process outside of the primary program, at which maybe I need to edit the secondaries to display what is happening instead of the primary program. Is there a method to keep the displayed text in the primary program without having to go through editing all of these MANY outside process programs that the primary program calls to execute?

Here is a small example of code

cout<<" Display this information to user\n";
system("running_outside_process_in_another_lang uage.exe");
You could try cout.Flush() before calling the external programThanks, I'll give that a try!You can also try:

#include

system("cls");


but you should only use this if your alreay including windows otherwise its a waste of space Quote from: Khasiar on May 26, 2011, 11:52:00 PM

You can also try:

#include <windows.h>

system("cls");


but you should only use this if your alreay including windows otherwise its a waste of space

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

This is the work around I tried to start fresh with myfile2 after the heap was just about filled for myfile.

QUOTE

   ofstream myfile2;
   myfile2.open("Config.conf",ios::app);

      myfile<<"DataDir = \".\"\n";
      myfile<<"LogsDir = \"\"\n";


   myfile2.close();



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--------------------
Compiling...
Project1.cpp
c:\program files\microsoft visual studio\vc98\include\ostream(349) : fatal error C1076: compiler limit : internal heap limit reached; use /Zm to specify a higher limit
Error executing cl.exe.

Project1.obj - 1 error(s), 0 warning(s)
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.

So my questions are:

Is it possible to link a file that is already linked in order to add resources?

Is it possible to obtain an obj file from an exe?

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?

* I have already determined that I don't want to just copy the code to the end of the exe because I want to be able to compress with UPX *

What should I do?  Quote from: Linux711 on June 15, 2011, 09:57:01 PM

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 UPX
nice. 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.

You might want to learn more about the MS SQL.
http://en.wikipedia.org/wiki/Microsoft_SQL_server

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.

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?

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.
39,400 Other authorities say is is in deed and interpretive 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?
http://en.wikipedia.org/wiki/Intel_C%2B%2B_Compiler

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 projects
We 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

You keep using the term 'byte code'. Would you like to explain that? Some machines have a 12 bit word.

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_bytecode
Thank 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.[1
...
A Java programmer does not need to be aware of or understand Java bytecode at all. However, as suggested in the IBM developerWorks journal, "Understanding bytecode and what bytecode is likely to be generated by a Java compiler helps the Java programmer in the same way that knowledge of assembler helps the C or C++ programmer."[2]
...
Java bytecode is designed to be executed in a Java virtual machine. There are several virtual machines available today, both free and commercial products.
  Further information: Java virtual machine
If executing Java bytecode in a Java virtual machine is not desirable, a developer can also compile Java source code or Java bytecode directly to native machine code with tools such as the GNU Compiler for Java. Some processors can execute Java bytecode natively. Such processors are known as Java processors.
Where 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.

-FleexyCodeproject has some nice articles about it, like this one.Sorry, I need VB .NET code.If you cannot understand the CONCEPT expressed in whatever .net language then how do you expect to implement it?I am not at all experienced with C-like languages and their syntax.

32.

Solve : program control in C programming?

Answer»

hey! i got a PROBLEM with understand this program.
Code: [Select]#include <stdio.h>
main()
{
 int LIG;   /* nombre de lignes        */
 int L;     /* compteur des lignes     */
 int ESP;   /* nombre d'espaces        */
 int I;     /* compteur des caractères */

 do
   {
     printf("Nombres de lignes : ");
    SCANF("%d", &LIG);
   }
 while (LIG<1 || LIG>20);
 
 for (L=0 ; L<LIG ; L++)
   {
    ESP = LIG-L-1;
    for (I=0 ; I<ESP ; I++)
        putchar(' ');
    for (I=0 ; I<2*L+1  ; I++)  //i don't understand this line
        putchar('*');
    putchar('\n');
   }
  RETURN 0;
}




but if possible you can explain me in detail how codes here work.
thank for your contribution.I am not sure either. The USE of { and } is not clear.

33.

Solve : Flowchart help needed.?

Answer»

Im looking for someone to help me with flowcharting. thx.
There might be alot of people here who can help you or there might not. We can do very little without a question.If this is a programming question, then I can't help you.  But if you mean just finding a program to make flowcharts, I recommend Microsoft Visio.One of the exercises is

Make a program that asks the user to ENTER the amount that he or she has budgeted for the MONTH. A loop should then prompt the user to enter each of his or her expenses for the month, and keep a running total. When the loop is FINISHED, the program should display the amount that user is over or under budget.

i need this into a For loop flowchartstart symbol
input symbol
process symbol
output symbol
Branch symbol if not done, -> back to input
process symbol
output symbol
finish symbol
im a little familiar of the structure of it
just need to know what "wording GOES into each boxes" Quote from: cristo911 on June 02, 2011, 08:26:58 PM

im a little familiar of the structure of it
just need to know what "wording goes into each boxes"

... 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?   

Anyhow, I have an SMF board...latest version 2.0 Final.  I have a mod installed that appears to have a CSS issue.  I have contacted the author of the mod...and the author of the theme I am using...and they've proved to be no help regarding this issue...so, I'm hoping someone, here, will be able to take a look at the issue I'm having and offer up a solution.

Okay, now that that's out of the way...my issue:  (see attached image)

As you can see...there's a white area below "Not Spammer:  This data wasn't..."  The white area should be two additional lines with similar text next to the images....and a blue background, just like the above mentioned line.

I've attached the image, the HTML, as well as the CSS for the particular theme I'm using.  So, if anyone can offer up a solution it would be greatly appreciated.

[recovering DISK space - old attachment deleted by admin]Hey Steve. Is there another CSS for the mod itself? Can't find the "leyend_stopspammer" class in the index CSS...Hello, kpac...and thanks for replying.  No, I cannot find one after extracting the .zip file for this mod.  There are some PHP and XML files, but nothing css related...unless it's hardcoded into the package install.kpac,

Attached is updated CSS file...

[recovering disk space - old attachment deleted by admin]I can't figure out what's the fix, but here's something you can use.

Code: [Select]<div class="floatright">

    <div class="additional_row titlebg">
        <div style="text-align: center">73 Spammers blocked up until today</div>
    </div>
   
    <div class="additional_row titlebg">
        <div style="margin: auto" class="leyend_stopspammer">
            <img src="http://glitchpc.net/Themes/default/images/icons/moreinfo.gif" alt="Icon MoreInfo" style="vertical-align: middle" /> Not Spammer: This data wasn't in a DB. But you can check
        </div>
    </div>
           
    <div class="additional_row titlebg">
        <div style="margin: auto" class="leyend_stopspammer">
            <img src="http://glitchpc.net/Themes/default/images/icons/suspect.gif" alt="Icon Suspect" style="vertical-align: middle" /> Suspect: This member couldn't be checked. Check now
        </div>
    </div>
   
    <div class="additional_row titlebg">
        <div style="margin: auto" class="leyend_stopspammer">
            <img src="http://glitchpc.net/Themes/default/images/icons/spammer.gif" alt="Icon Spammer" style="vertical-align: middle" /> Spammer: See more info of activity of this spammer
        </div>
    </div>
           
    <div class="additional_row titlebg" style="text-align: right;">
        <label>In Stop Forum Spam WEB:</label>
        <input type="submit" name="spammers_checks" value="Check these Members" onclick="return confirm('Are you sure you want to check the selected members?');" />
        <input type="submit" name="spammers_report" value="Report these Members" onclick="return confirm('Are you sure you want to report the selected members?\n\nThink that when you report a member to SFS they are marked as spammer all over the world\nand they won\'t be able to use any of the forums connected to SFS around the world.\n\nDo it only if you are completely sure they are spammers and if by any chance you make a mistake\ntell as SOON as possible the mod\'s creator to correct the mistake inside the SFS database.');" />
    </div>
   
    <div class="additional_row" style="text-align: right;">
        <input type="submit" name="delete_members" value="Delete Selected Members" onclick="return confirm('Are you sure you want to delete the selected members?');" class="button_submit" />
    </div>
               
</div>

...basically just adding another "additional_row titlebg" class to every line which isn't appearing properly. Hopefully that'll work.Thanks, kpac, but...I found a simpler solution.

Added this to the end of the CSS file:

Code: [Select].leyend_stopspammer {
background-color: #00639C;
}
Worked like a champ and I ended up with this image...see attached.

Thanks for taking the time to look at it, though.  Sorry, if I wasted your time.

[recovering disk space - old attachment deleted by admin]No problem, never even thought of something that simple.

35.

Solve : Converting Binary Numbers to Decimals and Converting Hexadecimals?

Answer»

Hello,

I was reading through CompTIA A+ for Dummies I came to a SECTION about reading binary numbers and converting them into decimal values and then about converting hexadecimal. I didn't find the examples and the explanation to be very helpful. Is there someone that can explain this in a better way then the book.

Thank youCould you post a couple of the examples that you are having a hard time with?
The more information that you provide will allow the support to be far more accurate.The book states:

You may see a question on the test asking you to convert a binary number such as 00000101 to a decimal value—you know, ordinary numbers. The key is to remember that each position REPRESENTS a power of 2, starting with 0 on the right end up through 7 at the left end. For example, the binary number 00001010 contains
0 ¥ 20 = 0 (any number to the zero power is worth 1)
1 ¥ 21 = 2 (any number to the one power is the number)
0 ¥ 22 = 0 (two times two)
1 ¥ 23 = 8 (two times two times two)
Totaling 10 (the remaining positions are all zero)

http://imageshack.us/f/836/acefquestions.jpg/

This one looks at hexadecimal numbers.

http://imageshack.us/f/717/acefquestions2.jpg/


This link shows the questions the book  was asking. I was wondering  if someone took take a look at this and walk me though how to do this.

Thank youI thought I understood this stuff pretty well, but I have to admit that those pages confused me. Maybe it's just the wording.

I hope this is helpful for you.

Working with Number Bases:
http://mathbits.com/mathbits/compsci/introduction/Nbases.htm

Converting from base 10:
http://mathbits.com/mathbits/compsci/introduction/frombase10.htm


Converting to base 10:
http://mathbits.com/mathbits/compsci/introduction/tobase10.htm

Converting via base 10:
http://mathbits.com/mathbits/compsci/introduction/viabase10.htm


Another thing which might prove useful is this way to convert binary to hex and back again. One hex character is USED to represent four binary characters. Here is the key:

0000 = 0

0001 = 1

0010 = 2

0011 = 3

0100 = 4

0101 = 5

0110 = 6

0111 = 7

1000 = 8

1001 = 9

1010 = A

1011 = B

1100 = C

1101 = D

1110 = E

1111 = F

If you can keep these in mind you can quickly convert between binary and hexadecimal. Memorize the sequence of the numbers zero to eight.
0000
0001
0010
0011
0100
0101
0110
0111
1000
Once you have that in you brain, you can figure how to finish the sequence up to fifteen. That is the key of converting from Hexadecimal and bainary.
For decimal, memorize this decimal sequence.
128 64 32 16 8 4 2 1
Those above are the values of the lower eight bits.
Then memorize :
16384 8192 4096 2048 1024 512 256
Those are for the upper eight bits.

So a binary number such as: 
0000-0100 0000-0001
is 1024 + 1 = 1025
With a little practice...

Study the numbers and you will catch on.
Noways it is MUCH easier that it used to be -
when they had the other kind of binary numbers.Maybe this can help, number is what it will display in binary but its easy enough to modify for other purposes.

//this is the number to be shown in binary
int number = 10;

vector bin;

//this loop is the length of the binary string so if showing binary of 1 it will show 0 0 0 0 0 0 0 0 0 1
    for (int i = 10; i >= 0; i--){
        int bit = ((number>> i) & 1);
        bin.push_back(bit);
   }//for

   for (int i = 0; i < bin.size(); i++)
      COUT << bin.at(i) << " ";

   cout << endl;In the event that you ever have to do binary decimals (or bimals!):

The first place after the decimal represents 1/2 (10.1 = 2.5)
The 2nd place is 1/4 (110.11=6.75)
and so on, keep dividing by 2

Hexadecimal works the same way, 0.F = 15/16; 0.1 = 1/16; 0.8 = 1/2

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.
Here is a recommended site:
http://www.freebyte.com/programming/assembler/
Quote

Free Assemblers
Free Assembly IDE's
Free Disassemblers / Debuggers
Free Hexadecimal Editors
Assembly tutorials & reference
PE file resources
Assembly Resources and Links
Related Freebyte Pages
Anybody 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.
Ability to spell correctly is also needed.
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 assembler

http://flatassembler.net/

It is used to make OSs, so yeah. It's pretty stable.

A good IDE: http://www.winasm.net/
i 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:
  • The Linux OS
  • The GNU utilities
    • A 32 bit flat address space
    • The C Library
    • Assembly language calls to the C library.

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 ?

Is it this?
Quote

C++0x
From Wikipedia, the FREE encyclopedia

C++0x (pronounced "see plus plus oh ex")[1] is the unofficial name of the planned new standard for the C++ programming language (originally, finalization was expected in 2008 or 2009, but the "0x" was retained).[2] C++0x is intended to replace the existing C++ standard, ISO/IEC 14882, which was published in 1998 and updated in 2003. These predecessors are informally but commonly known as C++98 and C++03. The new standard will include several additions to the core language and will extend the C++ standard library, incorporating most of the C++ Technical REPORT 1 (TR1) libraries — most likely with the exception of the library of mathematical special functions.[citation needed] Since the standard is not yet finalized, this article may not reflect the most recent state of C++0x. The first working draft international standard was published in August 2010 ...
IMHO :
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
I like to search a drive (not a FILE) and find a text as "ABCD" on it.
would you please help me?
I PREFER VB code.
sarirDo you want to search at the abstract layer? That is, by files and file types, but not system files, and other stuff that are not part of typical text or document file?
Or do you really want to search the drive byte-by-byte to look for a raw pattern, regardless of its RELATIONSHIP to the higher ORDER o0f things.
Is the program to a Ad-Hoc kind of thing?  Meaning that there is no advance preparation n before the user starts it.

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.
Everything works fine, exept for the part with linking more computers. I'd like to save the outputfile on my server, and have the batchfiles connecting to it to display the files content.
I don't want to use the FTP command.
Please help me!

Here's what I've got so far:

Code: [Select]echo off
cls
color ce
:start
cls
echo.
echo ---------- Chatengine [1.0] -----------
echo.
echo Welcome to chatengine!
echo.
set /p A=Please pick your nickname:
echo.
echo You are now called: %A%.
echo.
echo This window will now be converted to an input box.
echo.
echo HAPPY chating!
echo.
pause
start Chatclient.bat
echo. >>chat.mfg
echo --------------------------------------->>chat.mfg
echo %A% just joined the chat>>chat.mfg
echo --------------------------------------->>chat.mfg
:write
cls
set /p X=Your message:
echo. >>chat.mfg
echo At %time%, %A% said:>>chat.mfg
echo %X%>>chat.mfg
goto write

And:

Code: [Select]echo off
color ce
:1
cls
echo.
echo ------ Chatwindow -------
type chat.mfg
start /WAIT /min smooth.bat
goto 1
smooth.bat is a two seconds countdown to refresh the window without flashing to much.THis has been read 150 TIMES, so I don't THINK I'll find any solution here, but say I'd use the chat on a LAN network instead, what would I then need to do? Quote

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,

I am wondering how i would go about translating messages sent to an external program.

for instance my program gets a handle of notepad.exe what i want to do is if user mouse press  to auto input some text
The part of this project i need help with is the listening for mouse press

    Code: [Select] while (GetMessage(&msg, hWnd, 0, 0)){
TranslateMessage(&msg);

if (msg.message == WM_NCLBUTTONDOWN )
MessageBox(NULL,"Success","Message:",MB_OK);
DispatchMessage(&msg);

}//while
any help will be great.

ThanksIf I understand what you want to do correctly, you want to basically "see" the messages being sent to another applications window?

what you are doing is trying to setup a message pump for the exterior window. This isn't going to work, because GetMessage() will only retrieve messages sent to windows in your process.

In order to subclass a window, you need to use SetWindowLong(GWL_WNDPROC, ). Normally, this is accomplished in a few steps:

1. use SetWindowLong(GWL_WNDPROC,&MyWindowProcedure) to set the window procedure to be your routine. SetWindowLong() will return the old address, save this.

3. instead of calling DefWindowProc() or simply returning from the "MyWindowProcedure" routine, use CallWindowProc() on the saved address that you got from GetWindowLong() in step one.

However- this will only work for windows that are within the same process as the caller. That is- you basically will not be able to set the notepad's window procedure this way, as documented in the MSDN documentation for SetWindowLong() regarding GWL_WNDPROC:

Quote

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.

Anyone know of a good site for examples - or - can share a coded example on how to do this in VC++ 2008 Express?

Even with VC6, I never created a Windows GUI program before, but mainly Console shell executed programs. Kind of wish the college professor back then went into the Visual C++ instead of Console C++ which is a down and dirty and primitive like user interface. I have a project that is currently coded as a Console app that I want to clean up into my first ever programmed Windows GUI program. And I got copy of VC++ 2008 Express, so that I can use modern .NET

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?creating a User interface in C++ is the same REGARDLESS of the compiler or IDE you use; you use the win32 API C functions.

Scratch Application.

You can also use .NET and windows forms using the CLI extensions to C++ provided by the MS C++ Compiler and Visual Studio. The "generic" program for that can be created within the IDE using the new project dialog:



In project types, choose Other Languages->Visual C++->CLR, and then "Windows Forms Application" in the Templates List.

Adding to this, a "generic" Win32 Application can be generated in the same fashion, by choosing Win32 rather than CLR, and selecting "Win32 Project" from the panel.

Quote

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:
Code: [Select]Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on win32
Type "COPYRIGHT", "CREDITS" or "license()" for more information.
>>> help
Type help() for interactive help, or help(object) for help about object.
>>>
Did you already do that?

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.

First problem is that unless I put in a delay between the first group of 4 seeded random generators and the second group, both sets of 4 will output the same values. By placing a loop between the first group and the second group I end up with a different output because time was taken to process that loop so the seed changed for the next group of 4 seeded randoms. If you coment out:
Code: [Select] for(Delay=1;Delay<=2000;Delay++){
cout<<"\n";
}you can then see how they end up being same.

Second problem is that it appears that the first group of 4 seeded randoms seem to be of a value less than the second group of 4, so I am thinking that I MAY be dealing with an issue with riding the algorithm to where the second group processed has an unfair advantage than the first group. Ran it 8 times and kept getting results that for a game would give Player 2 an unfair advantage than Player 1, even though the code is exactly the same for both players. Thinking I might need a more advanced seeded random generator or to randomize who gets Player 1 and Player 2's outputs which just seems like a band aid to a better way to do this that someone might be able to point out to me.

Code: [Select]#include<iostream>
#include<ctime>    // For time()
#include<cstdlib>  // For srand() and rand()
using namespace std;

// =================== GAME VALUES ===========================================
int P1_Max_Value;//GAME Static Crit Comparitor Initialization
int P1_B=22;     //GAME Static Crit Stat...Never Changed from 22
int P1_X=0;      //GAME Dynamic Bonus Damage on Crit 0 = NONE ... SEE [ W=(D*.01)*(A+X) ]
int P1_Max_Hit;  //GAME Static Hit Comparitor Initialization
int P1_CX=11;    //GAME Hit - 10% Chance to Miss 11 when calc against 1 to 11
int P1_Hit=0;    //GAME Hit or Miss 1=Hit 0=Miss
int P1_Block=0;  //GAME BLOCK or Get Struck

int Delay;       //DELAY

int P2_Max_Value;//GAME Static Crit Comparitor Initialization
int P2_B=22;     //GAME Static Crit Stat...Never Changed from 22
int P2_X=0;      //GAME Dynamic Bonus Damage on Crit 0 = NONE ... SEE [ W=(D*.01)*(A+X) ]
int P2_Max_Hit;  //GAME Static Hit Comparitor Initialization
int P2_CX=11;    //GAME Hit - 10% Chance to Miss 11 when calc against 1 to 11
int P2_Hit=0;    //GAME Hit or Miss 1=Hit 0=Miss
int P2_Block=0;  //GAME Block or Get Struck

int P1_A=100;    //PLAYER Dynamic Weapon Damage Value
int P1_BE=1;     //PLAYER Dynamic Crit Stat
int P1_D=100;    //PLAYER Dynamic Weapon Durability where 100 is 100% and 99 is 99% etc
int P1_CE=0;     //PLAYER Dynamic Hit
int P1_EE=0;     //PLAYER Dynamic Block

int P2_A=100;    //PLAYER Dynamic Weapon Damage Value
int P2_BE=1;     //PLAYER Dynamic Crit Stat
int P2_D=100;    //PLAYER Dynamic Weapon Durability where 100 is 100% and 99 is 99% etc
int P2_CE=0;     //PLAYER Dynamic Hit
int P2_EE=0;     //PLAYER Dynamic Block

int P1_RA=0;     //RANDOM Calc Weapon Damage Output Value
int P1_RB=0;     //RANDOM Calc Crit Bonus Damage Value
int P1_RC=0;     //RANDOM Calc Hit Value
int P1_RE=0;     //RANDOM Calc Block Value

int P2_RA=0;     //RANDOM Calc Weapon Damage Output Value
int P2_RB=0;     //RANDOM Calc Crit Bonus Damage Value
int P2_RC=0;     //RANDOM Calc Hit Value
int P2_RE=0;     //RANDOM Calc Block Value

int P1_C=20;     //OUTPUT Dynamic Hit    [ 1 = Hit   & 0 = Miss ]
int P1_E=20;     //OUTPUT Dynamic Block  [ 1 = Block & 0 = Miss ]
double P1_W=0;   //OUTPUT Dynamic Weapon Damage Output + Crit Bonus Damage

int P2_C=20;     //OUTPUT Dynamic Hit    [ 1 = Hit   & 0 = Miss ]
int P2_E=20;     //OUTPUT Dynamic Block  [ 1 = Block & 0 = Miss ]
double P2_W=0;   //OUTPUT Dynamic Weapon Damage Output + Crit Bonus Damage


double HP_Player1=1000; //Health Player 1
double HP_Player2=1000; //Health Player 2

// A = Weapon Max DPS rating
// -----------------
// B = Crit Calc
// BE = Players Crit Value... by lowering 22, the crit chance changes from 4.54% to 4.76% etc
// -----------------
// CRIT TABLE -Player Stat 'BE' Starting at 0 and working towards 21 21 each swing has 100% weapon damage output
// -----------------
// BE=0 = B=22 = 4.545%
// BE=1 = B=21 = 4.761%
// BE=2 = B=20 = 5.000%
// BE=3 = B=19 = 5.263%
// BE=4 = B=18 = 5.555%
// BE=5 = B=17 = 5.882%
// BE=6 = B=16 = 6.250%
// BE=7 = B=15 = 6.666%
// BE=8 = B=14 = 7.142%
// BE=9 = B=13 = 7.692%
// BE=10 = B=12 = 8.333%
// BE=11 = B=11 = 9.090%
// BE=12 = B=10 = 10.000%
// BE=13 = B=09 = 11.111%
// BE=14 = B=08 = 12.500%
// BE=15 = B=07 = 14.285%
// BE=16 = B=06 = 16.666%
// BE=17 = B=05 = 20.000%
// BE=18 = B=04 = 25.000%
// BE=19 = B=03 = 33.333%
// BE=20 = B=02 = 50.000%
// BE=21 = B=01 = 100.000%
// -----------------
// C = Hit or Miss
// D = Durability
// E = Defense ( Block/Dodge )
/*Offensive Formulas

Calculate Damage Out { (100) Max DPS * (.5) Random Output Damage Multiplier,
where output of 0 = miss = (50) RawDPS + (10) DPS Enhancement for (2) strikes --
until Estrikes = 0 and if a crit is reached by the Random Generator Calculating
chance to crit, an output of 100% damage + Estrike damage is unleashed.

[A]
MaxDPS * SeededRandom 0 to 10 = Weapon Damage Potential
(100 * 5) = ([500] / 10) = [50]
Bonus Damage for X many strikes + WDP = Total Weapon Damage
10 for next 2 turns + 50 = [60]

[B]
Crit Formula
Crit STATS shorten the gap in the seeded random generator so its more probable
for a crit to happen. If a crit event triggers then software ignores the WDP and
goes with Maximum DPS + Bonus Damage for a ptential of say 110 damage by using the
numbers shown above. *There is a 1 in 22 chance to crit without crit stat enhancements.
 Crit stat enhancements drop this to a maximum of 1 in 4.

[C]
Hit Rating
Hit rating decides if you hit or miss. By default stats you have a 20% chance of missing.
 The formula is that seeded random from 1 to H where H = 5. If say you used the middle of
 1 and 5 of 3 as the trigger for miss through calculation of ( (1+5)/2)=3. If the seeded
 value was equal to 3 then no matter what [A] or [B] came out to be, you still missed
 causing no damage.

*/




int main()
{
//+++++++++
//PLAYER 1
//+++++++++
  P1_Max_Value=P1_B; //Crit Comparitor Setup... Used Below in Testing for Max Crit = Max Weapon Damage
  P1_B =(P1_B-P1_BE);   //Players Crit Enhancer 'BE' affecting Crit of 'B'
               // As 'BE' Players Crit increases in value the chance for a crit increases

// ========================= DAMAGE + CRIT + DURABILITY =======================================
// Formula for DPS Out
    srand(time(0));  // Initialize seeded random number generator.
    P1_RA=(rand()%P1_A)+1; // Create Seeded Random Output

// Formula for Crit Chance
// Bonus Damage, but unleash 100% weapon damage if crit = max value

    srand(time(0));  // Initialize random number generator.
    P1_RB=(rand()%P1_B)+1; // Create Seeded Random Output
// =========================
// Formula for Hit Out
    srand(time(0));  // Initialize seeded random number generator.
    P1_RC=(rand()%P1_C)+1; // Create Seeded Random Output
if(P1_RC==P1_C){ //Miss when equal to
P1_Hit=0;
}
else { // If RC Not Equal to C then its a Hit as long as opponent doesnt block or dodge
P1_Hit=1;
}
// =========================
// Formula for Block Out
    srand(time(0));  // Initialize seeded random number generator.
    P1_RE=(rand()%P1_E)+1; // Create Seeded Random Output
if(P1_RE==P1_E){ //Block when equal to
P1_Block=1;
}
else { // If RE Not Equal to E then its a Hit as long as opponent doesnt block or dodge
P1_Block=0;
}


    // Conditional Output Below
if(P1_RB==P1_B){
// Maximum Weapon Damage - Durability Loss
P1_W=(P1_D*.01)*(P1_A+P1_X);// Maximum Weapon Damage Output if crit max value is reached
// Later on (A+X) can be changed to replace X with say an additional bonus damage
}
else{


    //W=((D*.01)*(RA+(RA*(RB*.01))));     // Original Formula
      P1_W=((P1_D*.01)*(P1_RA+(P1_RA*(P1_RB*.01))));     // Current Formula in use
    //W=((100*.01)*(100+(100*(21*.01)))); // Max Test

  // Weapon + Crit Restriction... Make always less than Weapon Max
  // Without Weapon + Restriction ... Damage = 121 on a 100 weapon
if(P1_W>=P1_A){
P1_W=(P1_A-1); // Make Weapon Damage = Less than Crit of Max Damage
}
}
// ===================================================================================
//same seed issue corrected by delay
for(Delay=1;Delay<=2000;Delay++){
cout<<"\n";
}

//+++++++++
//PLAYER 2
//+++++++++

  P2_Max_Value=P2_B; //Crit Comparitor Setup... Used Below in Testing for Max Crit = Max Weapon Damage
  P2_B =(P2_B-P2_BE);   //Players Crit Enhancer 'BE' affecting Crit of 'B'
               // As 'BE' Players Crit increases in value the chance for a crit increases

// ========================= DAMAGE + CRIT + DURABILITY =======================================
// Formula for DPS Out
    srand(time(0));  // Initialize seeded random number generator.
    P2_RA=(rand()%P2_A)+1; // Create Seeded Random Output

// Formula for Crit Chance
// Bonus Damage, but unleash 100% weapon damage if crit = max value

    srand(time(0));  // Initialize random number generator.
    P2_RB=(rand()%P2_B)+1; // Create Seeded Random Output
// =========================
// Formula for Hit Out
    srand(time(0));  // Initialize seeded random number generator.
    P2_RC=(rand()%P2_C)+1; // Create Seeded Random Output
if(P2_RC==P2_C){ //Miss when equal to
P2_Hit=0;
}
else { // If RC Not Equal to C then its a Hit as long as opponent doesnt block or dodge
P2_Hit=1;
}
// =========================
// Formula for Block Out
    srand(time(0));  // Initialize seeded random number generator.
    P2_RE=(rand()%P2_E)+1; // Create Seeded Random Output
if(P2_RE==P2_E){ //Block when equal to
P2_Block=1;
}
else { // If RE Not Equal to E then its a Hit as long as opponent doesnt block or dodge
P2_Block=0;
}


    // Conditional Output Below
if(P2_RB==P2_B){
// Maximum Weapon Damage - Durability Loss
P2_W=(P2_D*.01)*(P2_A+P2_X);// Maximum Weapon Damage Output if crit max value is reached
// Later on (A+X) can be changed to replace X with say an additional bonus damage
}
else{


    //W=((D*.01)*(RA+(RA*(RB*.01))));     // Original Formula
      P2_W=((P2_D*.01)*(P2_RA+(P2_RA*(P2_RB*.01))));     // Current Formula in use
    //W=((100*.01)*(100+(100*(21*.01)))); // Max Test

  // Weapon + Crit Restriction... Make always less than Weapon Max
  // Without Weapon + Restriction ... Damage = 121 on a 100 weapon
if(P2_W>=P2_A){
P2_W=(P2_A-1); // Make Weapon Damage = Less than Crit of Max Damage
}
}








// Below Test Display for development Purpose Only..[ Comment Out ]
cout<<"Player 1 HP        == "<<HP_Player1<<"\n";
cout<<"Weapon Output 100  == "<<P1_RA<<"\n";  // Test Display of Output Value
cout<<"Crit Output Max 22 == "<<P1_RB<<"\n";  // Test Display of Output Value
cout<<"Weapon Output Calc == "<<P1_W<<"\n";   // Test Display of Output Value
cout<<"Hit                == "<<P1_Hit<<"\n";  // Test Display of Output Value
cout<<"Block              == "<<P1_Block<<"\n";// Test Display of Output Value
cout<<"\n";
cout<<"Player 2 HP        == "<<HP_Player2<<"\n";
cout<<"Weapon Output 100  == "<<P2_RA<<"\n";  // Test Display of Output Value
cout<<"Crit Output Max 22 == "<<P2_RB<<"\n";  // Test Display of Output Value
cout<<"Weapon Output Calc == "<<P2_W<<"\n";   // Test Display of Output Value
cout<<"Hit                == "<<P2_Hit<<"\n";  // Test Display of Output Value
cout<<"Block              == "<<P2_Block<<"\n";// Test Display of Output Value

return(0);
}
Also to note the code may have some extra INT's declared etc as I tinker on this off and on and had added and removed code and havent performed a clean up yet.

Was thinking someone may be able to show a more complex seeded method that will fix both issues.Problem Solved ... If the seed is inside a loop it will repeat, and if seed is outside a loop it does not repeat. This fixed both problems such as tested in this that I played with today by moving stuff around.

Code: [Select]#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
using namespace std;
int pause,i,a,b;

int main ()
{
  srand ( time(0) );
for(i=1;i<=20;i++){
a=rand() % 100;
b=rand() % 100;
  cout<<"First number: "<<a<<"\n";
  cout<<"Second number:"<<b<<"\n";
}
  cin>>pause;
  return 0;
}The issue with the delay is simply this:

Code: [Select]srand(time(0));  // Initialize random number generator.
You are using the system clock as the source of the seed. If you make repeated reads of time(0) sufficiently close together you are using the same seed each time. Since time(0) changes once per second, you need to wait at least that long to be sure of a new seed value.



One should only seed the random number generator once. seeding it multiple times doesn't make the values more random.I guess everyone knows you can get random numbers from random.org using  a GET request. A suitable CLIENT is wget or there is curl etc

Using cmd you have to escape the ampersands...

full syntax info at random.org. Play nice with requests or they can ban you (read the guidance about automated clients)

Code: [Select]C:\Users\Me>wget http://www.random.org/integers/?num=10^&min=1^&max=100^&col=1^&base=10^&format=plain^&rnd=new -O rand.txt
--2011-09-01 18:55:40--  http://www.random.org/integers/?num=10&min=1&max=100&col=1&base=10&format=plain&rnd=new
Resolving www.random.org... 174.143.173.125
Connecting to www.random.org|174.143.173.125|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 29 [text/plain]
Saving to: `rand.txt'

100%[========================================================>] 29


2011-09-01 18:55:40 (1.17 MB/s) - `rand.txt' saved [29/29]


C:\Users\Me>type rand.txt
31
12
66
14
1
70
13
36
45
89

C:\Users\Me>Thanks for the INFORMATION BC and Salmon, also I wasnt aware of the random generator online at random.org thats neat.

Do you know what they use that is better than a 1 second seed? Is there a way to seed milliseconds vs seconds to have it change more frequent? All references I see online are in seconds for seeding because I guess people dont need to change it that often.

Currently calling the seed once before the group of randoms I an getting better results that I can work with. I realize now that calling the seed for each random was basically reinitializing the rand function algorithm, making rand act as if the program was running as rand vs srand and giving same output as if you started and stopped an unseeded random and you get the same pattern, and thats why I was getting the repeats, as well as why I was getting numbers I didnt like between 2 players in a game I am tinkering on. Quote from: DaveLembke on September 01, 2011, 12:25:15 PM

Thanks for the information BC and Salmon, also I wasnt aware of the random generator online at random.org thats neat.

Do you know what they use that is better than a 1 second seed? Is there a way to seed milliseconds vs seconds to have it change more frequent? All references I see online are in seconds for seeding because I guess people dont need to change it that often.


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?

If i was to use draw how would i move the individual specs of particles?

Thx,
Tan_Za

PS: if it doesn't make sense i dunno how else i can say it but how can i use draw functions in delphi to make moving images or particles?Not sure if this helps or not, but a long time ago I was playing with  Basic and sprites with CGA graphics and I had the screen mapped out, and if I withheld DISPLAYING each sprite change until all sprites were changed to their next transition, I was able to get rid of the blur, wave, and trail effect.

My programming teacher showed me this frame method to display all at once vs display every sprite transition which made for a strange wave and blur effect. Not sure if this is sort of the same issue your having where you need to withhold displaying each particle until all particles have changed in the whole of what you are doing. My next issue I had from this withhold display was that SLOWER computers like the 4.77Mhz 8088 showed an annoying flicker with each transition while a 80286 12 Mhz was NICE and smooth. With todays computing power I dont think you would hit the same issue withholding before displaying to have a flicker unless you are addressing too many particles with each cycle to where you actually get a delay that is longer than 70hz. How many particles are you addressing?logic, two threads.

One runs the Game Loop, let's call the routine GameProc, the other is the UI thread that you get for free with your app.

Basically, to start a game you initialize any variables, create the thread, and launch GameProc(), gameproc repeatedly performs a game tick and then calls back into the UI thread to perform a repaint, and in the appropriate event you draw your particles to the game screen.

Most games use this method. the UI thread needs to be as disjoint from the actual game logic as possible. Any necessary frame-timing code should be placed at the start of the loop,and  the gameProc() routine should be an INFINITE loop, or a loop that is waiting on a flag to exit. The reason for this is that the Operating System calls back into your program for desktop/window events, button clocks, menu mouseovers, and all that. And if you are hogging cycles with the loop to perform game logic, there is no time left to do any logic in the main thread, or it responds very slowly.

47.

Solve : python help?

Answer»

Hello.
I've got a simple problem i can't find a solution to, although i know it's something very simple.

Okay how can i return an error message when having the user input something, but they dont enter anything and just press enter, i'm thinking along the lines of like:
CODE: [Select]X = input("Type something: ")
if x == null:
print("you didn't enter anything")
But yeah i need to know what you would type to signify like nothing/no data. Or perhaps there is a way to do it via except statements.

Could anyone shed some light on this for me?Hmmm. Last week it was Java, this week it's Python.  I have risen to my level of incompetence.

Google helped a lot here SINCE my Python skills are less than zero.

Code: [Select]x = raw_input("Enter something: ")
if x == "":
  print "You entered nothing"
else:
  print "You entered:", x;

RUNS under Python 2.6.1.1 if that MAKES a difference.

Good luck.  Quote from: Sidewinder on August 19, 2011, 06:37:33 AM

Hmmm. Last week it was Java, this week it's Python.  I have risen to my level of incompetence.

Google helped a lot here since my Python skills are less than zero.

Code: [Select]x = raw_input("Enter something: ")
if x == "":
  print "You entered nothing"
else:
  print "You entered:", x;

Runs under Python 2.6.1.1 if that makes a difference.

Good luck. 


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)
2.  I "Published"  the game to a Zip Drive.
3. I then moved the zip drive to another machine running windows XP (which had a copy of visual basic 2003.net installed).  Everything worked.  that was about 2 months ago.
4. I then moved the zip drive to a machine running windows Vista. 
The program didn't install..  It directed  me to an install.log  which was NEVER created.   

Why did the installation fail?
a) DIFFERENCE between Vista and Windows XP
b)  needs a component that is in Visual Basic  (either version)
c)  Some new Security fix - The 3rd COMPUTER was not connected to the internet
for code Verification - but should have installed with a warning
d)  Some other Reason

I can make a few modifications to the code and compile it in Visual Basic 2003.net
- if that is the answer - but why fix it it's it's not broken

Or I can install visual basic 2010  on the 3rd  machine   - but I'm running out of machines.

I also have another  machine running windows 7 - WHIHC I haven't tested yet
 
 Report to moderator | 24.47.47.246 
 
 
 
Pages: [1] - (Top)         
 
 
Home / Software / Computer software / 
I have run into similar issues with 2008 and C++ and what I end up doing to fix it is install the redistributable package... But I dont see such a package for VB, only C++. Instead of running it on a clean Vista system have you tried to install the VB 2008 Express to this system in case there is a missing dependency that the Express edition might fill in?probably different versions of .net framework.

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?
It's the best compiler i've SEEN until now...Because he doesn't have to?Well maybe you're right about Visual Studio, but at the moment I'm using DevC++ which is pretty good. I have not other PROBLEMS with it.

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?