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

Username/Email:
  

Password
  





Search Forums

(Advanced Search)

Forum Statistics
» Members: 2,799
» Latest member: Jerrygef
» Forum threads: 856
» Forum posts: 3,643

Full Statistics

Online Users
There are currently 4 online users.
» 1 Member(s) | 1 Guest(s)
Bing, Google, MorrissgoX

Latest Threads
Looking for Adventure? Fi...
Forum: Random Discussion
Last Post: iHOMEz
11-16-2024, 09:18 PM
» Replies: 0
» Views: 457
Prettys Womans in your to...
Forum: Random Discussion
Last Post: iHOMEz
10-30-2024, 07:45 AM
» Replies: 0
» Views: 734
Prettys Womans in your ci...
Forum: Random Discussion
Last Post: iHOMEz
10-26-2024, 10:50 AM
» Replies: 0
» Views: 766
Beautiful Womans from you...
Forum: Random Discussion
Last Post: iHOMEz
10-19-2024, 02:48 PM
» Replies: 0
» Views: 862
Prettys Womans in your ci...
Forum: Random Discussion
Last Post: iHOMEz
10-06-2024, 05:00 PM
» Replies: 0
» Views: 1,030
Womans from your city - V...
Forum: Random Discussion
Last Post: iHOMEz
07-28-2024, 10:26 AM
» Replies: 0
» Views: 1,408
Supreme Сasual Dating - A...
Forum: Random Discussion
Last Post: iHOMEz
06-14-2024, 11:28 AM
» Replies: 0
» Views: 1,831
Beautiful Womans in your ...
Forum: VB.NET
Last Post: iHOMEz
06-09-2024, 09:23 PM
» Replies: 0
» Views: 1,633
Hangman in Rust
Forum: Other
Last Post: brandonio21
02-04-2018, 11:14 AM
» Replies: 2
» Views: 20,631
How to: Search files from...
Forum: VB.NET
Last Post: brandonio21
11-25-2017, 12:55 PM
» Replies: 1
» Views: 15,942

 
  Character ammount
Posted by: .righteous - 04-25-2016, 06:32 AM - Forum: Java - Replies (1)

I've just finished watching your tenth "Learning Java" part and I want to limit the character number to five digits only. 
I've tried this:

Code:
import java.util.*;
public class digitExtractorTester {
    static Scanner userInput = new Scanner(System.in);
    
    public static void main(String[] args){
        String rNumber = "12345";
        System.out.print("Enter a custom, five digit number: ");
        String nSequence = userInput.next();
        System.out.println(" ");
        if (nSequence.chars() != rNumber.chars()){
            System.out.println("Your input contains too many or too less digits.\nOnly five digit numbers are allowed.");
        }
        else{
        digitExtractor byMath = new digitExtractor(Integer.valueOf(nSequence));
        byMath.returnNumberSequenceByMath();
        System.out.println(" ");
        digitExtractor byChar = new digitExtractor(nSequence);
        byChar.returnNumberSequenceByChar();
        }
    }
}
But it doesn't seem to be working. Any suggestions?

Never mind. I solved my own problem.
If anyone's wondering, I was using chars() when I was supposed to be using length(). (Source of information)

Code:
nSequence.length() != rNumber.length()

Print this item

  Hangman in Rust
Posted by: brandonio21 - 03-30-2016, 05:15 PM - Forum: Other - Replies (2)

After about a year hiatus, I have decided to come back to Rust. When I was learning it previously, I wrote "rustic tac toe"

This time around, I decided to write a very simple Hangman game. It isn't anything special, but when you write your first few programs in a new language, they feel special. I just wanted to share the program with you guys Smile

I have attached the output of git-archive for your perusal. 

.zip   hangmanrs.zip (Size: 146.69 KB / Downloads: 1496)

I have also attached the standalone binaries (Compiled on ArchLinux 4.4.5-1). 

.zip   hangmanbin.zip (Size: 821.25 KB / Downloads: 1403)

Don't be shy to check it out, but also don't be shy to offer criticism! I am still new when it comes to Rust.

Print this item

  Krypton Toolkit Download
Posted by: brandonio21 - 03-28-2016, 07:55 PM - Forum: VB.NET - No Replies

It has come to my attention that the Krypton Toolkit (ComponentFactory) is no longer available for download. Instead, the page simply contains no download link.

In the past, certain components of the software were free, while others were free for a limited number of days. In order to continue using the software indefinitely, a license key is needed.

Since the files are no longer available from the ComponentFactory webpage, here is the link to 4.4

http://www.megafileupload.com/nb2X/Krypton440.zip


(Apologies for the file provider.. it's a pretty big file)

Print this item

  RunAsAdmin
Posted by: brandonio21 - 09-28-2015, 11:14 AM - Forum: VB.NET - Replies (2)

It was pointed out by a viewer of my original RunAsAdmin video that the files for RunAsAdmin have seemed to disappear from the web. I am putting them here for public access. If you are a viewer of the aforementioned video, the file that is of interest to you is "RunAsAdmin.zip", available here:
.zip   RunAsAdmin.zip (Size: 21.46 KB / Downloads: 2109)


If you are a developer, you may download the source package here:
.zip   RunAsAdmin_source.zip (Size: 166.87 KB / Downloads: 2293)

Print this item

  Adding backgroundcolor to snake applet
Posted by: Kevin - 08-28-2015, 08:51 AM - Forum: Java - Replies (1)

Hi guys,

first, i'm not the best english speaker and -writer. Therefore i ask you to apologize my language mistakes Smile

Problably in your eyes, i have a very simply problem, but i cant add the background function to Brandonio's Snake Project. I want to have a black background in the applet. After this, i want to change the color of the grid to white.

I try to add two JPanel's to snakeApplet.java. But is it still not working. Every time i started the Applet, the background is white.



Code:
import java.applet.Applet;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;

import javax.swing.JPanel;

public class snakeApplet extends Applet{

    private snakeCanvas c;
    JPanel jp1 = new JPanel();
    JPanel jp2 = new JPanel();
    
    public void init()
    {
        jp1.setBackground(Color.BLACK);
        add(jp1);
        
        jp2.setBackground(Color.BLACK);
        add(jp2, BorderLayout.SOUTH);
        
        c = new snakeCanvas();
        c.setSize(new Dimension(640, 480));
        c.setPreferredSize(new Dimension(640, 480));
        c.setVisible(true);
        c.setFocusable(true);
        this.add(c);
        this.setVisible(true);
        this.setSize(new Dimension(640, 480));
        
    }
    
    public void paint(Graphics g)
    {
        this.setSize(new Dimension(640, 480));
    }
}
In addition, i want to add music to the applet. The music should instantly playing if the applet is open.
If the idea of the black background and white grid is not to be a looker, than i would to add a picture in the background of the grid.
But i dont know how i can code it.
I hope someone can help me please Smile
Yours sincerley
Kevin

Edit: Kevin is only a nickname Big Grin

Print this item

  Using a string as an alias/nickname
Posted by: strawman83 - 06-04-2015, 09:12 AM - Forum: VB.NET - Replies (1)

So part of the application I am building is a user blog, where the user can submit new blog entries or view previous entries. I've managed to write to/read the blog entry to and from a text file, with a 9 digit date format in front of the entry.

The problem I am having is that when I am loading the previous entries into a comboBox, it is loading all the text from the blog into each item of the comboBox.

What I want to do is load the date of the blog into the comboBox only, and when the user clicks on said date the entire blog text file is loaded into a textBox.

In the code below, I really need the blogAlias string to act as alias/nickname in the comboBox for the actual blog text. But I can't figure out how to do it.

Code:
'Fill comboBox with array of previous blog entries

While j < blogLineCount

          blogAlias = blogArray(j).Substring(1,9)
          comboBox1.Items.Add(blogArray(j))
          j = j + 1


End While

Print this item

  Read all lines from multiple text files.
Posted by: strawman83 - 05-29-2015, 08:24 PM - Forum: VB.NET - Replies (2)

Hello. Nice site.

I just recently viewed on of the BP youtube tutorials on how to get all the files from a certain directory.

I was wondering if there was a way of amending it so that every line of every text file in a directory could be stored into an array?


Thanks.

Print this item

  Filter each cell in dgv
Posted by: t3cho - 04-24-2015, 12:44 PM - Forum: VB.NET - Replies (4)

I have the datagridview on my form and i want to filter it for current text in textbox1.

Example i have fields
Name,Lastname,Location,Town,Address.

And if i enter in textbox1 value "John" i need to check each of those columns does any contain a value John and show on dgv.

Anel

Print this item

  Knuth Numbers recursion
Posted by: Miriam - 04-21-2015, 11:46 PM - Forum: Java - Replies (1)

Hello,

I recently had a final exam on which my teacher asked to write a method for Knuth numbers recursion. I got a stack overflow on my implementation, and I am new on Java, so I am not sure what happened, it might be that I had the wrong formula for Knuth numbers? I would love some feedback.

Here is the question, and my code

Knuth numbers are given by the recursive formula Kn+1 = 1 + min (2 * Ka, 3 * Kb) where a is the smallest integer larger than n/2.0 and b is the smallest integer larger than n/3.0. The use of doubles in the denominator is necessary to ensure that integer division is not used.

For example, if n is 7, then a equals 4 and b equals 3 and thus K8 = 1 + min (2* K4, 3 * K3).

If n is 8, then a equals 5 while b remains 3 and thus K9 = 1 + min (2 * K5, 3 * K3).
If n is 9, then a remains 5 while b equals 4 and thus K10 = 1 + min(2 * K5, 3 * K3).

Mathematically, “the smallest integer larger than x” is the “ceiling” function. If n is an int, then n / 2 is calculated using integer division, discarding the remainder; but you want the division to give you a double. Thus you need code that looks like this:

int a = Math.ceil(n / 2.0);
int b = Math.ceil(n / 3.0);

Since the equation defining Knuth numbers is a recursive one, we must have a base case; let’s assume that K0 = 1.

Create and test a class called KnuthNumbers (in a project also called KnuthNumbers) which includes a static method to compute Knuth numbers.


my code:


Code:
public class KnuthNumbers
{
   /**
    * Recursive Knuth Numbers 1, 3, 3, 4, 7, 7, 7, 9, 9, 10, 13, ...  
    */
   public static int knuthNumber(final double n)
   throws DataFormatException{
       double a = Math.ceil(n / 2.0);
       double b = Math.ceil(n / 3.0);
       // bad input
       if (n < 1)
           throw new DataFormatException("n cannot be less then 1");
       if (n > 12)
           throw new DataFormatException("n is too large. Max is 12");
       //base case
       if (n == 1)
           return 1;

       //recursion

       return knuthNumber(a + b);
   }
}




TEST:

Code:
public class KnuthNumbersTest
{
   

   @Test
   public void testKnuthNumber(){
       long startTime = 0;
       long endTime = 0;
       double result = 0;

       try {
           assertEquals(-1, KnuthNumbers.knuthNumber(-3));
           fail("number should not be negative");
       }
       catch (DataFormatException e){
           assertEquals("n cannot be less then 1", e.getMessage());
       }
       catch (Exception e) {
           fail("Unexpected exception: " + e.toString());
       }

       try {
           assertEquals(0, KnuthNumbers.knuthNumber(0));
           fail("number should not be zero");
       }
       catch (DataFormatException e){
           assertEquals("n cannot be less then 1", e.getMessage());
       }
       catch (Exception e) {
           fail("Unexpected exception: " + e.toString());
       }

       try {
           assertEquals(1, KnuthNumbers.knuthNumber(1.0));
           assertEquals(9, KnuthNumbers.knuthNumber(5.4));
           assertEquals(13, KnuthNumbers.knuthNumber(7.6));
       }
       catch (Exception e) {
           fail ("Unexpected exception: " + e.toString());
       }

   }

}

Print this item

  C Tutorial Series
Posted by: brandonio21 - 04-18-2015, 12:44 PM - Forum: C - Replies (1)

So I have been thinking about doing a C tutorial series for quite some time now. In my opinion, C is the ultimate programming language. It's fairly low level (It compiles straight to assembly), it runs fast, it has decades of improvements built into it, and tons of community support.

Basically, C is used for most system programming. That is, if you want to make a utility for your operating system, you would usually do it in C. Of course, a lot of things these days are also written in C's self-deemed successor, C++. For instance, take the following programs:

Linux - C
Windows - C/C++/C#
Mac OSX - C/Objective-C

All of which are written in C or its many variants. Because of this, I think it is important to make a C tutorial series that will also lead into C++, since the two are fairly related. The C portion of the tutorial will be based on the K&R, so people can easily follow along if they own the book.

What are your guys' thoughts?

Print this item