Bunker -4 Newbie Poster

A straightforward solution to printing multiple integers is to use a loop. For example, in Python, you could use a "for" loop to iterate through a list of integers and print each one. This method is simple and effective.

trueframe 15 Newbie Poster

To make a basic elevator simulation, first, identify the floors and the elevator's capacity. Then, use loops and conditionals in programming to mimic its movement. Include buttons for users to call the elevator and select floors. Test thoroughly for accuracy.

SCBWV 71 Junior Poster

I don't understand a few things. There are option buttons and there are check boxes. So I don't know what you mean by "option button checkbox." I also don't know what you mean by "record." Do you mean print? Read values from a file?

I would suggest instead of checking for "1" that you use "If chkExtra(0).Value = vbChecked", which is a VB constant and probably compiles more efficiently.

rproffitt commented: From memory that's a valid example. Let's hope arcon engages and supplies a minimum viable example rather "code is broken." +17
arcon 51 Light Poster

thanks for everything

arcon 51 Light Poster

because it still works and there are many people who use it, thank you

arcon 51 Light Poster

because it still works and there are many people who use it, thank you

rproffitt 2,580 "Nothing to see here." Moderator

I noted the issues with your post and the problems with what is a dead system. While I do have one last VB6 dev laptop in storage I only pull it out for paid work. And at 250USD a hour the only company that pays is very careful about their requests.

You ignored how such problems are presented. ZIP file? Too dangerous today. You could have posted the code snippet along with what lines you think the problem is at.

Finally there's the issue of how you wrote up the problem description and more so the lack of a document detailing the expected software operation. AKA the spec.

Sure, go ahead and claim I didn't supply the solution when you didn't supply the problem properly.

Reverend Jim 4,780 Hi, I'm Jim, one of DaniWeb's moderators. Moderator Featured Poster

Yes. People continue to ask about VB6. They shouldn't. And you likely won't see anyone answering questions about, for example, COBOL or QuickBASIC, except in a historical context. The only VB6 question that should be asked is "why are you still using it?"

arcon 51 Light Poster

Sorry but you have not given a solution to the issue, because I see that here in this forum people continue to ask about vb6.0

rproffitt commented: You didn't supply the code in the clear. ZIP file? I won't open it and then the problems noted above. +17
rproffitt 2,580 "Nothing to see here." Moderator
  1. With so few having VB6 now, you need to move to a current release. Help will be hard to find.
  2. I can't load up your project. Few others can so by not posting the relevant code in the clear with your assessment, you see the issue?
  3. VB6, while I coded very large projects long ago, "It's Dead Jim." That is, you're on a deserted island.
  4. VB6 let us set breakpoints, examine variables and more. I continue to find old and new developers that don't know how to use the system.
arcon 51 Light Poster

I think I can record but I can't read with the option button checkbox
I don't know if I do the recording procedure correctly

Fergus_1 0 Newbie Poster

ok so i have a page with a gridview on it and it displays rows from sql table. i have also a link assigned to each row:

<asp:GridView ID="GridViewMatters" runat="server" AutoGenerateColumns="False" OnRowDataBound="GridViewMatters_RowDataBound">
    <Columns>
        <asp:BoundField DataField="client_ref" HeaderText="Client Reference" />
        <asp:BoundField DataField="our_ref" HeaderText="Our Reference" />
        <asp:BoundField DataField="client_name" HeaderText="First Name" />
        <asp:BoundField DataField="section_name" HeaderText="Second Name" />
        <asp:BoundField DataField="curr_status" HeaderText="Status" />
        <asp:TemplateField HeaderText="">
            <ItemTemplate>
                <asp:HyperLink ID="lnkDetails" runat="server" Text="View" NavigateUrl='<%# Eval("our_ref", "MD_Overall.aspx?id={0}") %>' />
            </ItemTemplate>
        </asp:TemplateField>
    </Columns>
</asp:GridView>

this works fine and the url that gets displayed is good. But i would like to send the our_ref attribute to the page itself aswell as the url and use it make further queries.

Thanks

G

Digital_39 0 Newbie Poster

Hi, Its helpful for me. I got my answer.

jprog1000 0 Newbie Poster

Great reply, vortex! Agree with all your points.

vortex_1 0 Newbie Poster

In my opinion, implementing a feature in a bouncing balls simulation where a new ball is created when two balls collide can add an interesting and dynamic element to the simulation. This feature can introduce a sense of complexity and unpredictability, making the simulation more engaging and challenging for users. It could also provide an opportunity to explore concepts related to conservation of momentum and energy, as the new ball's initial velocity and direction could be determined based on the properties of the colliding balls.

However, it's important to consider how this feature would affect the overall behavior and realism of the simulation. In a real-world scenario, the creation of a new ball upon collision is not a natural occurrence, and implementing this feature could potentially detract from the educational or realistic aspects of the simulation.

If the primary goal of the bouncing balls simulation is to accurately model and demonstrate the physics of ball collisions, then adding a feature where a new ball is created upon collision may not be appropriate. However, if the simulation is intended to be more of a game or interactive experience where realism is not the primary concern, then this feature could be a fun and engaging addition.

In conclusion, the decision to implement a feature where a new ball is created when two balls collide in a bouncing balls simulation should be based on the intended purpose and audience of the simulation mod manager. While it can add an element of complexity …

jprog1000 0 Newbie Poster

Got it. Thank you so much!

toneewa 81 Junior Poster in Training

Yes, this is true. Overlapping ball spawns can do that causing a chain reaction. Something like that could be done. How you handle the spawning of the new ball is what I played with a bit before.

You will see better collision detection changing to:

 g.fillOval(ball.getX(), ball.getY(), 1 * ball.getRadius(), 1 * ball.getRadius());
jprog1000 0 Newbie Poster

Hello,
Thank you again so much! All your additions are clear, but it seems like whenever two balls collide, more than one ball is added to the arraylist and painted. Any way to have just one ball added to the panel for every collision? Have some kind of a toggle flag in paintcomponent?

Regards

simhakidsden -4 Newbie Poster

A preschool management system is a tool or software used to organize and manage activities, records, and communication within a preschool. It helps streamline tasks like enrollment, attendance tracking, scheduling, and parent communication for efficient operation.

Salem commented: chatGPT pith and piffle a decade too late -4
toneewa 81 Junior Poster in Training

I cleaned up the code some more. Removed some things that were not being used. I ran into a couple problems which caused the freeze you mentioned. It was memory heap space and array allocating. E.g., if x or y becomes negative, and also infinite recursion. I added a x/y coordinate display for a ball, and tinkered with the placement of the incremental balls being added, so it wouldn't add a lot at each collision. Hope that helps.

Ball.java

import java.awt.Rectangle;
public class Ball{
    private int x;
    private int y;
    private final int radius;
    final int panelheight = 500;
    final int panelwidth = 500;
    private int xDx = 1;
    private int yDy = 1;
    private boolean xUp, yUp = false;
    public Ball(int x, int y, int radius){
        this.x = x;
        this.y = y;
        this.radius = radius;
        this.xUp = false;

    }

    public void move(){
        if ( y <= 0 ) {
            yUp = true;
            yDy = ( int ) ( Math.random() * 5 + 2 );
        }
        else if ( y >= this.panelheight - 2* this.radius ) {
            yDy = ( int ) ( Math.random() * 5 + 2 );
            yUp = false;
        }
        if ( x <= 0 ) {
            xUp = true;
            xDx = ( int ) ( Math.random() * 5 + 2 );
        }
        else if ( x >= this.panelwidth - 2 * this.radius ) {
            xUp = false;
            xDx = ( int ) ( Math.random() * 5 + 2 );
        }
        if (xUp)
            x += xDx;
        else …
Dani 4,084 The Queen of DaniWeb Administrator Featured Poster Premium Member

… oh, sorry, missed the bit about you still needing clarifications. Feel feee to ask :) I’ll now unmark this topic as solved. /facepalm

Dani 4,084 The Queen of DaniWeb Administrator Featured Poster Premium Member

I’ll mark this question solved :)

jprog1000 0 Newbie Poster

Thank you so much for your reply and additions! It is certainly working as I wanted. I will read through the code you have added and ask you any questions I might have. I hope you don't mind.

Regards

toneewa 81 Junior Poster in Training

Some minor syntax fixes. Some things to consider are the collision and distance of drawing the next ball. A ball inside a ball's radius will cause numerous collisions. Even the starting ball locations can be already causing collisions. I added a collision counter display. Increased the maximum balls to make to 50. The timer delay can also impact the collision detection. Try this and see if you still get freezing.

Ball.java:

import java.awt.Rectangle;
public class Ball{
    private int x = 0;
    private int y = 0;
    private int radius;
    private int panelwidth = 500;
    private int panelheight = 500;
    private int xDx = 1;
    private int yDy = 1;
    private boolean xUp, yUp;
    public Ball(int x, int y, int radius){
        this.x = x;
        this.y = y;
        this.radius = radius;
        this.xUp = false;
        this.yUp = false;
        this.xDx = 1;
        this.yDy = 1;
    }

    public void move(){
        if ( y <= 0 ) {
            yUp = true;
            yDy = ( int ) ( Math.random() * 5 + 2 );
        }
        else if ( y >= this.panelheight - 2* this.radius ) {
            yDy = ( int ) ( Math.random() * 5 + 2 );
            yUp = false;
        }
        if ( x <= 0 ) {
            xUp = true;
            xDx = ( int ) ( Math.random() * 5 + 2 );
        }
        else if ( x >= this.panelwidth - 2 * this.radius ) {
            xUp = false;
            xDx = ( int ) ( Math.random() * 5 + 2 );
        }
        if (xUp)
            x += …
jprog1000 0 Newbie Poster

Hello,
I have a program which creates multiple balls and bounces them off when they collide. This works fine.

import java.awt.Rectangle;
public class Ball{
    private int x = 0;        
    private int y = 0;        
    private int radius;
    private int panelwidth = 500;
    private int panelheight = 500;
    private int xDx = 1;        
    private int yDy = 1;        
    private boolean xUp, yUp;
    public Ball(int x, int y, int radius){
        this.x = x;
        this.y = y;
        this.radius = radius;
        this.xUp = false;
        this.yUp = false;
        this.xDx = 1;
        this.yDy = 1;
    }

    public void move(){
        if ( y <= 0 ) {
            yUp = true;
            yDy = ( int ) ( Math.random() * 5 + 2 );
        }
        else if ( y >= this.panelheight - 2* this.radius ) {
            yDy = ( int ) ( Math.random() * 5 + 2 );
            yUp = false;
        }
        if ( x <= 0 ) {
            xUp = true;
            xDx = ( int ) ( Math.random() * 5 + 2 );
        }
        else if ( x >= this.panelwidth - 2 * this.radius ) {
            xUp = false;
            xDx = ( int ) ( Math.random() * 5 + 2 );
        }
        if (xUp)
            x += xDx;
        else
            x -= xDx;
        if ( yUp )
            y += yDy;
        else
            y -= yDy;
    }

    public int getX(){
        return this.x;
    }

    public int getY(){
        return this.y;
    }

    public void changeDirection(Ball b){
        if (this.x <= b.x && this.y <= b.y){
            this.xUp = false;
            this.yUp = false;
            b.xUp = true;
            b.yUp …
Digital_39 commented: Its really helpful. +0
Thomasio 0 Newbie Poster

Thanks @toneewa that looks like what I want, at least a basis from where I can try to work it out for my needs.

JILA 0 Newbie Poster

if i provide you with my project OOP java can you transform him for me to GUI

toneewa 81 Junior Poster in Training

The Windows Media Foundation API is probably what you are thinking of. You also can just use my example, using the ffmpeg library. Just change the filename.

extern "C" {
#include <libavformat/avformat.h>
#include <libavformat/avio.h>
}

int main() {
    AVFormatContext* fmt_ctx = NULL;
    int ret;

    // read the header of input stream.
    ret = avformat_open_input(&fmt_ctx, "snow.mp4", NULL, NULL);
    if (ret < 0) {
        av_log(NULL, AV_LOG_ERROR, "Cannot open input file\n");
        return -1;
    }

    // find stream information.
    ret = avformat_find_stream_info(fmt_ctx, NULL);
    if (ret < 0) {
        av_log(NULL, AV_LOG_ERROR, "Cannot find stream information\n");
        return -1;
    }

    // dump info on input or output format.
    av_dump_format(fmt_ctx, 0, "snow.mp4", 0);

    // Close an opened input AVFormatContext.
    avformat_close_input(&fmt_ctx);
    return 0;
}

Output:

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'snow.mp4':
      Metadata:
        major_brand     : isom
        minor_version   : 512
        compatible_brands: isomiso2avc1mp41
        encoder         : Lavf60.3.100
      Duration: 00:00:05.80, start: 0.000000, bitrate: 370 kb/s
        Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720, 298 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
        Metadata:
          handler_name    : Core Media Video
          encoder         : Lavc60.3.100 libx264
        Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 64 kb/s (default)
        Metadata:
          handler_name    : Core Media Audio

Output 2:

Input #0, matroska,webm, from 'ofc.mkv':
  Metadata:
    ENCODER         : Lavf58.29.100
  Duration: 00:00:39.37, start: 0.000000, bitrate: 6474 kb/s
    Stream #0:0: Video: h264 (High), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 60 fps, 60 tbr, 1k tbn, 120 tbc (default)
    Metadata:
      DURATION        : 00:00:39.367000000
    Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp (default)
    Metadata:
      title …
Salem 5,138 Posting Sage

If you want to know what windows is up to when you do something, then try using https://learn.microsoft.com/en-us/sysinternals/downloads/procmon

rproffitt 2,580 "Nothing to see here." Moderator

Regarding "doesn't open the file". I've used so many tools over the years to profile and log what apps access that I can write that Windows does open the file for a peek.

And then we have the problem that many files don't have duration. https://www.loc.gov/preservation/digital/formats/fdd/fdd000105.shtml is for MP3 and it's not in the base spec.

But how do they do it? Spoiler: Everyone cheats. Example: https://stackoverflow.com/questions/20771845/how-to-get-the-size-and-duration-of-an-mp3-file Note this was 2019 and even then, duration isn't in the MP3 file.

This is quite the rabbit hole to go down so I suggest you use MediaInfo or try one of the three functions of https://github.com/stax76/Get-MediaInfo