Welcome, Guest
You have to register before you can post on our site.

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 2,361
» Latest member: DerekDrums
» Forum threads: 848
» Forum posts: 3,635

Full Statistics

Online Users
There is currently 1 user online
» 0 Member(s) | 1 Guest(s)

Latest Threads
Hangman in Rust
Forum: Other
Last Post: brandonio21
02-04-2018, 11:14 AM
» Replies: 2
» Views: 18,223
How to: Search files from...
Forum: VB.NET
Last Post: brandonio21
11-25-2017, 12:55 PM
» Replies: 1
» Views: 13,786
Database error anyone hel...
Forum: VB.NET
Last Post: brandonio21
11-25-2017, 12:46 PM
» Replies: 2
» Views: 15,702
Character ammount
Forum: Java
Last Post: brandonio21
04-28-2016, 02:13 PM
» Replies: 1
» Views: 17,508
RunAsAdmin
Forum: VB.NET
Last Post: brandonio21
04-15-2016, 11:11 AM
» Replies: 2
» Views: 20,025
Krypton Toolkit Download
Forum: VB.NET
Last Post: brandonio21
03-28-2016, 07:55 PM
» Replies: 0
» Views: 10,816
Adding backgroundcolor to...
Forum: Java
Last Post: brandonio21
09-01-2015, 10:09 PM
» Replies: 1
» Views: 14,395
Using a string as an alia...
Forum: VB.NET
Last Post: brandonio21
06-20-2015, 09:00 PM
» Replies: 1
» Views: 13,319
Read all lines from multi...
Forum: VB.NET
Last Post: strawman83
06-04-2015, 08:54 AM
» Replies: 2
» Views: 17,330
Filter each cell in dgv
Forum: VB.NET
Last Post: brco900033
05-08-2015, 09:51 AM
» Replies: 4
» Views: 22,191

 
  Website Giveaway Program
Posted by: brandonio21 - 01-06-2014, 11:12 AM - Forum: Code Snippets - No Replies

Many of the viewers of the website giveaway video have requested that I share the source code of the program used. In order to heed these requests and ensure that everyone knows that the giveaway is fair, here is the code for the website giveaway program.

Basically, it reads from a text file containing all the comments, parses the text file for usernames, and randomly selects one of them. Any forced waiting is simply for dramatic effect and time creation.

The winner selector:
[code2=java]import java.util.Scanner;
import java.util.Random;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.io.File;
public class comments
{
private static ArrayList<String> commentList;
private static ArrayList<String> removeList;
public static void main(String[] args)
{
System.out.println("Welcome to the giveaway calculator!");
System.out.println("This is for use by BrandonioProductions for his");
System.out.println("2013-2014 website giveaway! Press <ENTER> to begin");
Scanner waiter = new Scanner(System.in);
waiter.nextLine();
System.out.println("First, gathering YouTube comments, please wait.");
for (int i = 0; i < 5; i++)
{
System.out.print(".");
rest();
}
System.out.println();
commentList = new ArrayList<String>();
removeList = new ArrayList<String>();
//First, we need to read from the file
try
{
Scanner reader = new Scanner(new File("comments.txt"));
reader.useDelimiter(System.getProperty("line.separator"));
while (reader.hasNext())
{
String line = reader.next();
if (line.contains("week"))
{
//This is a username
int ind = line.indexOf("1 week ago");
String username = line.substring(0, ind);
if (commentList.contains(username))
removeList.add(username);
else
commentList.add(username);
}
}
reader.close();
}
catch (FileNotFoundException e)
{
e.printStackTrace();
}
System.out.format("We found %d entries! Press <ENTER> to continue", commentList.size());
waiter.nextLine();
System.out.println("Removing duplicate entries, please wait..");
for (String s : removeList)
commentList.remove(s);
for (int i = 0; i < 5; i ++)
{
System.out.print(".");
rest();
}
System.out.println();
System.out.println("We are good to go! Press <ENTER> to get the first winner!");
waiter.nextLine();
Random rnd = new Random();
int winner1 = rnd.nextInt(commentList.size());
System.out.format("The first winner has entry # of %d", winner1);
for (int i = 0; i < 5; i++)
{
System.out.print(".");
rest();
}
System.out.println();
System.out.format("The first winner is: \n %s \n", commentList.get(winner1));
System.out.println("Press <ENTER> to get the second winner!");
waiter.nextLine();
int winner2 = rnd.nextInt(commentList.size());
System.out.format("The second winner has entry # of %d", winner2);
for (int i = 0; i < 5; i++)
{
System.out.print(".");
rest();
}
System.out.println();
System.out.format("The second winner is: \n %s", commentList.get(winner2));
}

public static void rest()
{
try
{
Thread.currentThread();
Thread.sleep(1000);
}
catch (Exception e) {}
}
}[/code2]

The text file is attached
[attachment=0]<!-- ia0 -->comments.zip<!-- ia0 -->[/attachment]

You can also find the program on Pastebin:
<!-- m --><a class="postlink" href="http://pastebin.com/DzLdPzGc">http://pastebin.com/DzLdPzGc</a><!-- m -->



Attached Files
.zip   comments.zip (Size: 5.58 KB / Downloads: 755)
Print this item

  Drunk_Snake Game PLEASE HELP!!
Posted by: andre2pi - 12-29-2013, 04:16 AM - Forum: Programming Help - Replies (2)

Hello everyone! I'm trying to implement a funny version of the snake game posted on youtube by brandonioproduction , and I'm kind of stucked. The idea is to make the snake wobble after eating some fruits ( that in the end will be changed to beers <!-- sWink --><img src="{SMILIES_PATH}/icon_e_wink.gif" alt="Wink" title="Wink" /><!-- sWink --> )
so by the move() when the snake is going direction.NORTH for example , the coordinates are (head.x , head.y -1) so it goes straight up.
I have to implement something that changes the head.x like this:

case Direction.NORTH:
newPoint = new Point(head.x -1, head.y - 1);
then
newPoint = new Point(head.x +1, head.y - 1);
then
newPoint = new Point(head.x -1, head.y - 1);
then
newPoint = new Point(head.x +1, head.y - 1);

so you get the idea here. The snake would zigzag in x axis when moving vertically. and of course also would zigzag in the y axis when going horizontally.

Any Ideas are very welcome !!
cheers!

Print this item

  Help needed to recreate a vb6 program into vb2010
Posted by: icedemonzz - 12-15-2013, 08:20 AM - Forum: VB.NET (Visual Basic 2010/2008) - Replies (1)

i need some help to recreate this program into vb2010 it was coded in vb6 there are some changes i need to make to this program but im having some problems trying to recreate it
<!-- sArrow --><img src="{SMILIES_PATH}/icon_arrow.gif" alt="Arrow" title="Arrow" /><!-- sArrow --> heres the link on how the program works
https://drive.google.com/folderview?id=0...sp=sharing

<!-- sArrow --><img src="{SMILIES_PATH}/icon_arrow.gif" alt="Arrow" title="Arrow" /><!-- sArrow --> this link must be paste into c:/ beacuse the data frm the program is stored there
[url]
<!-- m --><a class="postlink" href="https://drive.google.com/folderview?id=0B0a_4emJ1XJmX0pXY1oxWVFJTkk&usp=sharing">https://drive.google.com/folderview?id= ... sp=sharing</a><!-- m -->[/url]

<!-- sArrow --><img src="{SMILIES_PATH}/icon_arrow.gif" alt="Arrow" title="Arrow" /><!-- sArrow --> here the link off my progress on how far im gone
[url]
<!-- m --><a class="postlink" href="https://drive.google.com/file/d/0B1Aag3Xqa7xqbWVHNFBRZVNrUms/edit?usp=sharing">https://drive.google.com/file/d/0B1Aag3 ... sp=sharing</a><!-- m -->[/url]
could some one advise me on how to remake this program

<!-- sArrow --><img src="{SMILIES_PATH}/icon_arrow.gif" alt="Arrow" title="Arrow" /><!-- sArrow --> you can email/skype/facebook if u willing to help me <!-- s:?: --><img src="{SMILIES_PATH}/icon_question.gif" alt=":?:" title="Question" /><!-- s:?: -->

Print this item

  How to export Snake Game as a Runnable JAR file?
Posted by: bedigursimran - 11-19-2013, 10:01 PM - Forum: Programming Help - No Replies

Hi Guys.

I got the snake Game working great and I made a few changes to it too. And I was wondering if there is any way that I can save this as a 'Runnable Jar' file, so I can give it to my friend and try it without having Eclipse. Because it always give me an error like "couldn't find the main". I looked in the code provided by BrandonioProductions as well, and there wasn't any 'public static void main(String[] args)'.

Thanks,
Any help would be appreciatedSmile

Print this item

  Help finding problem
Posted by: gfb - 10-22-2013, 12:09 PM - Forum: Programming Help - Replies (1)

I have been following these tutorials but I can't seem to find the problem. I changed some names just so that it makes me think a little more.
Here is what i have:

Code:
public class digitextractor {
    int number = 0;
    String snumber = "";
    
    public digitextractor(int numberSequence) {
        int number = numberSequence;
    }
    
    public digitextractor(String numberSequence){
        snumber = numberSequence;
    }

    public void returnorder(){
        
        int integer1 = 0;
        int integer2 = 0;
        int integer3 = 0;
        int integer4 = 0;
        int integer5 = 0;
        
        integer1 = (number % 10);
        integer2 = (number % 100) / 10;
        integer3 = (number % 1000) / 100;
        integer4 = (number % 10000) / 1000;
        integer5 = (number % 100000) / 10000;
        
        System.out.println(integer1 + "\n" + integer2 + "\n" +
    integer3 + "\n" + integer4 + "\n" + integer5);
    }
    
    
    public void returnorderThroughString(){
        char part1;
        char part2;
        char part3;
        char part4;
        char part5;
        
        part1 = snumber.charAt(4);
        part2 = snumber.charAt(3);
        part3 = snumber.charAt(2);
        part4 = snumber.charAt(1);
        part5 = snumber.charAt(0);
        
        System.out.println(part1 + "\n" + part2 + "\n" + part3 + "\n" + part4 + "\n" + part5);
    }
}

Code:
import java.util.Scanner;
public class digitfinished {
    
    static Scanner input = new Scanner(System.in);

    public static void main(String[] args) {
        // process starts
        System.out.println("Welcome to this thing." + "\n" + "Enter your number");
        String in = input.nextLine();
        digitextractor product = new digitextractor(Integer.parseInt(in));
        product.returnorderThroughString();
        System.out.println("Using Strings");
        digitextractor output = new digitextractor(in);
        output.returnorderThroughString();
    }

}

Print this item

  Problems with dividing a string
Posted by: brco900033 - 10-19-2013, 12:09 PM - Forum: Programming Help - Replies (6)

I have already another question, I'm not asking how to do something for a change.

I have written something but it seems that it doesn't work properly and I don't know what the problem is.

The purpose of the code is to divide a key (length of key can varie) into parts of each 4 characters.
[code2=vbnet]Dim strings As New List(Of String)
'Just an example of the key, this string will be generated randomly
Dim s As String = "p6s0arJHmuOQmUhIczfnynRS1dOrRxYm0EF05b5Vk1YR7TQVItShNjFJQ1L3d"
Dim i As Integer = 0
Dim intMaxNumber As Integer = CInt(Math.Round((s.Length / 4), 0))
For i = 0 To intMaxNumber Step 4
strings.Add(s.Substring(i, 4))
Next
For Each srtininglist As String In strings
MessageBox.Show(srtininglist)
Next[/code2]
Everything goes fine when I debug it but it seems that the code only returns 4 parts, and it should (in this case) be about 16 parts.

I'm probably making a logical mistake but I can't figure out what I'm doing wrong.


Hope someone can help me out,
Brecht

Print this item

  Rename application file
Posted by: brco900033 - 10-12-2013, 06:25 AM - Forum: Programming Help - Replies (3)

Hi

Is there a way of renaming the application file itself while it is running? I saw somewhere a code snippet to do it and I think it is possible but I can't remember how.

Print this item

  Double Clickable
Posted by: justindude - 10-09-2013, 04:15 PM - Forum: Java - No Replies

How does one make a double clickable jar file so that it opens when you double click it and you don't have to go to the cmd to type java -jar jarfile.jar to send to people without jdk?

Print this item

  The forum is a mess - Let's fix it.
Posted by: brandonio21 - 09-20-2013, 11:06 PM - Forum: Computing - No Replies

Hey guys! I hope we're all doing well!

So I recently ran into a bunch of errors regarding an anti-spam mod I have been using for a bit. It turns out, my knowledge of phpBB is so minimal that updating the plugin(mod) caused the forum to die.

Well, this caused me to look into the forum's mySQL and FTP structures. They are a catastrophe.

Several years of uneducated modification has ruined the structure of the forum - so I am going to have to fix it. I am going to start by uninstalling all mods and starting from scratch. Keep in mind, users, posts, pictures, files, and all of our precious data shouldn't go anywhere. I will also be making regular backups.

With that being said, if you experience any forum downtime in the next few weeks - do not be alarmed! It is intentional! (More or less)

But - Do you guys have any suggestions for improvements for the forum? Theme suggestions? Ranking suggestions? Feature suggestions? Anything at all? Your contribution is much appreciated!


*Sorry for the crazy English - I am very tired.

Print this item

  NumberFormatException with Snake
Posted by: Timkat1994 - 09-16-2013, 03:04 AM - Forum: Programming Help - Replies (1)

Hi! I'm following the 8th video of the Snake tutorial and I seem to have missed something and/or completely screwed up. I just started trying to learn Java today and after watching the Tutorials I got started on following the Snake videos. I learn well by example, so these have all been fantastic. I've been at it for hours now, and I can't seem to find what I've done wrong here. The file on the snake page here doesn't have the High Score part added, otherwise I would compare that and mine. Any help would be much appreciated!

Here is the error message:

Exception in thread "Thread-3" java.lang.NumberFormatException: For input string: " 40"
at java.lang.NumberFormatException.forInputString(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at java.lang.Integer.parseInt(Unknown Source)
at snakeCanvas.CheckScore(snakeCanvas.java:175)
at snakeCanvas.Move(snakeCanvas.java:142)
at snakeCanvas.run(snakeCanvas.java:267)
at java.lang.Thread.run(Unknown Source)


Here is my progress:
<!-- m --><a class="postlink" href="http://pastebin.com/w7zjJ1fe">http://pastebin.com/w7zjJ1fe</a><!-- m -->

Print this item