Skip to content
View in the app

A better way to browse. Learn more.

Tip.It Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

clockwork

Featured Replies

I have this clock that I am making and was wondering if it was possible for java to randomly access any file, and open, that the user types in the pathing for. I am using this for the alarm portion of the clock so that an user can easily make a folder within one folder and then have the program open any music file located within it when the alarm goes off.

 

 

 

example:

 

Folder path was c:\desktop\blah

 

 

- Desktop -

blah
- hig
- file
- file
- fri
- file
- file
- die
- file
- file

Quote - Revenge is such a nasty thing that only breeds more vengeful souls, but in some situations revenge does not even need to be sought out, but only bided.

package tests;

import java.io.*;
import java.util.Random;

public class Main {
   Random rg = new Random();
   public static void main(String[] args) {
       File f = new File("C:\\");
       Main main = new Main();
       main.getRandomFile(f);
   }

   public File getRandomFile(File file) {
       File[] files = file.listFiles();
       int number = rg.nextInt(files.length);
       if(files[number].isDirectory()){
           System.out.println(files[number].toString());
           return getRandomFile(files[number]);
       }
        else{
           System.out.println(files[number].toString());
           return files[number];
        }
   }
}

 

 

Something I threw together in a few seconds, ignore the System outs :)

ivo2pe7.gif

http://www.tip.it/runescape/?herb

^^ A herblore cost/xp calculator. Any feedback would be greatly appreciated. Cleaning herbs has the values switched at the moment, but the fix has been submitted.

  • Author

Thanks. This will be very useful when I need to do something like this again.

Quote - Revenge is such a nasty thing that only breeds more vengeful souls, but in some situations revenge does not even need to be sought out, but only bided.

Create an account or sign in to comment

Important Information

By using this site, you agree to our Terms of Use.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.