Jump to content

prolemur

Retired Staff
  • Posts

    2,370
  • Joined

  • Last visited

Reputation Activity

  1. Like
    prolemur got a reaction from Ryois in Playing Multiple Videos After Each Other HTML   
    There appears to be an event for checking if the element has 'ended' for audio and video.
     
    https://stackoverflow.com/questions/2741493/detect-when-an-html5-video-finishes
    https://www.w3schools.com/tags/av_event_ended.asp
     
    You could then change the video source to the next video from your 'ended event handler' and reset the time to 0 and whatever other attributes needed.
    https://stackoverflow.com/questions/8402158/html5-video-javascript-controls-restart-video
     
    Hope these resources help with your wallpaper engine.
  2. Like
    prolemur reacted to patrickjp93 in C++ Just Got Standardized Garbage Collection (And Much More)!   
    The next time anyone says C++ doesn't have garbage collection and is a leaky nightmare, do the entire programming community a favor and 
    1) Slap the ignoramus
    2) Show them this
    3) Tell them it's been leak-free for 4 years
     
    No other programming language currently (not Rust, Go, Java or Python, I just checked) is actually leak-free by construction. Finally there exists a comprehensive lecture showing how to make it happen with nearly 0 overhead, possibly 0 if you're using the right compiler.
     
  3. Agree
    prolemur got a reaction from Mark77 in How are videos downloaded off youtube?   
    you could make a script to run this one multiple times.
    I was also thinking of making one because my bandwidth doesn't cound toward my cap from 2am - 8am, so (this script + a little cron job + list of youtube subscriptions + last time it was run) = awesome
  4. Agree
    prolemur got a reaction from ¨TrisT¨ in How are videos downloaded off youtube?   
    you could make a script to run this one multiple times.
    I was also thinking of making one because my bandwidth doesn't cound toward my cap from 2am - 8am, so (this script + a little cron job + list of youtube subscriptions + last time it was run) = awesome
  5. Like
    prolemur reacted to Mr_KoKa in Java: Count occurrence of the entered numbers?   
    You need one variable for one number to count, so if there would be input of 3 3 3 7 7 8 1 you would need 4 variables to count each number. 
    When you say array, do you mean that you would need array that looks like [1, 0, 3, 0, 0, 0, 2, 1] to store your counters?
    I would use associative array so it would look like {3 => 3, 7 => 2, 8 => 1, 1 => 1} so there is no unused space.
  6. Agree
    prolemur reacted to vanished in Help Decript   
    My guess is that it's not actually encrypted - you just opened a binary file in notepad and so it's displaying all of the data as random characters.
  7. Agree
    prolemur got a reaction from wangyuji431 in Make Image Pixel by Pixel   
    It is super easy in Java
     
    BufferedImage img = ImageIO.read(new File("image-orginal")); // change pixels in here with img.setRGB(x, y, rgb) ImageIO.write(img, "png", new File("image-final.png"));  
  8. Like
    prolemur reacted to KuJoe in How to run lines of code in CMD?   
    Renamed the .txt file to .bat or .cmd and you can just double click on it.
  9. Informative
    prolemur reacted to Hazy125 in Taking value from PHP into HTML in the same file   
    You can echo HTML tags and that will be interpreted correctly, you can also use PHP code inside of HTML tags. Examples
    <?php $uniqueID = 42; $product = 'Soy Sauce'; echo '<div id="' . $uniqueID . '">' . $product . '</div>'; ?> <div id="<?php echo '$uniqueID';?><?php echo '$product';?></div>"  
    As I am writing this it occurs to me that you may be asking about concatenation, what I did in the first code snippet with the full stops and all that. There are two ways to insert your variables into strings. There is the way you have done in your example, where the string is in double quotes. Doing it this way means all you have to do with your HTML tags when you echo them, is use them with this syntax <div id='stuff'></div> rather than <div id="stuff"></div>. Then you have the way I have done it, where the echo statement is in single quotes. Both work, I just prefer doing the full stop way because your text editor code highlights variables and I think it looks cleaner. It's also a tad faster if you happen to be printing out 5 million variables.
     
    Orrrrrr, your question could have nothing to do with concatenation, in which case, I hope the way I've answered things helps you rephrase your question  
  10. Agree
    prolemur got a reaction from IAmAndre in How do I run a command when another is on the run? in sh   
    I believe this runs the first command and then if it was successful the next command is run after, so not at the same time
    && would work well for apt-update && apt-upgrade though
  11. Agree
    prolemur reacted to trag1c in [Java] Simple 2D Engine   
    Please do, take some pride in your work and show it off. A random github repo with very little context isn't enticing. At the very least you should list its feature set if you intend on sharing it. 
     
    I am more than capable of going through the source code my self but that takes much of what little time i have free. I am sure this goes for many others as well. Save us the trouble as you would know it best.
     
     
  12. Like
    prolemur reacted to Pinguinsan in [C++11] Help With Templates   
  13. Agree
    prolemur got a reaction from trag1c in Bootstrap image carousel   
    You could edit your 'best answer' and share your solution for anyone else that has a similar problem
  14. Like
    prolemur got a reaction from elcou96 in Bootstrap image carousel   
    You could edit your 'best answer' and share your solution for anyone else that has a similar problem
  15. Like
    prolemur reacted to mariushm in Updating a PHP page with radio buttons   
    You should learn to use arrays.  Instead of 10 ifs for each item, you could do a for i from 1 to 10 and be done with it.
    Also, you can use an array for the error messages so you could simply say $ErrorList[] = 'something'; to add one error message to the list of errors or warnings. This way you can also display multiple errors, not just the last one detected.  Oh, and it's not common practice to use double negatives ... i mean you use $noErrors=false;  when you could instead use something like $errorFound = true;  ... the default state is false, no errors, so it seems kind of logical to flip a variable to true / yes when at least one error was detected, not the other way around " no errors flag is no longer true"    
    Group the radio buttons you want to show or hide in a div, give that div an id or name... use the selectbyid javascript thing to select the div and put the css property display:none; on it to hide, or display:block; or something else to make it visible.
     
  16. Funny
    prolemur reacted to Hazy125 in Need ideas for a project   
    AI. Machine learning algorithms. You can apply and test on twitch chat for example. Try to develop and algorithm that detects trends and comment popularity so your bot doesn't accidentally ban(fake ban in your program) people saying 'lol' or some such. Or don't use twitch. Try to scrape webpages and use your AI to correctly identify useful information and store it in a database. From there you can try and figure out a useful and efficient way to search the database. Or don't do any of that, my creativity is zero. But developing an AI for something is always an interesting project. I just don't have any time to do something like that myself
     
     
    EDIT: Oh, since you've experimented with game stuff, maybe make a better fish AI. Current fish AI is meh
  17. Agree
    prolemur got a reaction from elpiop in Java - Multiple Classes and Method Calling   
    Using enumerations would make the code a lot more manageable
     
    public enum Day { SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY }  
  18. Funny
    prolemur reacted to fizzlesticks in Python Syntax   
    It wants you to do it like that because if 3.14 was a variable you wouldn't be able to just add quotes around it. The proper way to do it if you have a literal number like that would be to just put it inside the rest of the string.
    print "The value of pi is around 3.14"  
    The trick to doing code academy is hitting the little x on the tab and finding a better place to learn, preferably a place that teaches Python 3.
  19. Agree
    prolemur reacted to vorticalbox in Need Help With Program For Programming Class In School   
    you need to add break; under cases
     
    switch() { case 1: //code break; case 2: //cdpe break; default: //this is incase the choice is not above break; }  
  20. Funny
    prolemur got a reaction from iasianxmofoii in Relational Model of a University.   
    You shouldn't be identifying students by their gender, gosh, this is 2016
  21. Like
    prolemur reacted to Hazy125 in PHP Newbie   
    <?php $hostname = exec('hostname'); echo 'This machine\'s hostname is ' . $hostname; ?> PHP has the ability to run commands from within a PHP file. Note that PHP files need to be run from a webserver. LAMPP is what you want for simplicity. Your PHP configuration has to be set so safe mode is off. Usually it is by default, but just in case. The exec function is not available when in safe mode. To run this script, make sure your PHP file is in the web root of your webserver and navigate to it from a web browser 
  22. Informative
    prolemur reacted to Nineshadow in Rotating Matrix - Java   
    Not useful here.
     
    A rotation matrix is used to rotate points in Euclidean space around an axis. To perform this rotation, you multiply the matrix with the column vector of each point. Something like this :
      (rotation around the x axis)
    Which is an ok way of handling rotations in Euclidean space, but it also introduces Gimbal lock when rotating along multiple axis(first x then y for example). A matrix can be generated to rotate around an arbitrary axis to prevent most Gimbal lock. For the arbitrary rotation axis {Rx,Ry,Rz}, this matrix would be :

    It doesn't prevent Gimbal lock entirely though; to do that we could use quaternions, which are a whole other topic.
     
  23. Like
    prolemur reacted to fizzlesticks in Using python class as struct?   
    self isn't a parameter, it's automatically set to the object before the dot.
    So, newGroup.addIP(client[0]) actually calls addIP(newGroup, client[0]). Just like C++ but in C++ the "self" parameter is hidden.
  24. Agree
    prolemur got a reaction from zarrexx in Python Regular Expression Help.   
    I only got this
    ^M(r|rs|s) ([A-Z].*)+$ It matches anything that starts with Mr, Mrs or Ms then a space, then a capital letter followed by 0 to unlimited other characters. That's where I got stuck. I don't know how to break out of that infinite character from the period when a space is the next character and match following words starting with a capital.
  25. Like
    prolemur reacted to Hazy125 in PHP/HTML not showing text   
    You aren't echoeing. If you have short tags enabled, you can do
    <h2><?= $row['article_title']; ?></h2> //Otherwise, you can just do a normal echo <h2><?php echo $row['article_title']; ?></h2>  
×