Millad.net Soon

Im working currently on my Version 8 of my portfolio site, witch will be launched soon this week or the next.  URL at http://www.Millad.net
 The site is up with a simple splash page I made quick to let you know its there. The blog will be moved there with all its content, new layout and portfolio site will be done also.
I would really appreciate some respond to some of my post, I kinda feel quite alone posting stuff, I hope Im doing good to others who visit the site and read stuff right here. 

Thank you very much for your time. 

Leave a Comment

Filed under General News

Leopard Tips: Search in stacks

.You can now search in stacks, by simply selecting your stack(pressing it) when it opens you can simply type the first letters of your application you want to launch and stacks will highlight it for you. Press (ENTER) to launch the application.  

Leave a Comment

Filed under Applications & Downloads

Leopard tips : Change upper bar icon position

You can easily change  the position of the small icons on the left upper corner of your mac os x leopard bar by holding the apple key and pressing(dragging) the icon you want and move it before or after the ones you wish to. 

Leave a Comment

Filed under Applications & Downloads

Condition Operator ( ?: )

Condition Operator that java provides (?:) can be used in place of an if..else statement. THis is a Java only ternary operator this means it takes three operands.

the first witch is before the ? is if the value is true or false – and after the ? is the action to be done IF TRUE and AFTER : is the action to be done if FALSE.

so its like this

//                          check true/false  ? true run this : false run this;
System.out.println( studenAge >= 18 ? "HE IS OVER 18" : "IS UNDER 18");

Leave a Comment

Filed under Programming & Java

OOP-Relationship & Two-dimensional Array

Object Oriented programming inheritance;Small Note: System.out.print(className) will go throw the class until he finds a toString() method and prints it out for you. So you dont need to type : System.out.print(className.toString); you just type the name if you only have ONE toString(). Two Dimensional Array: 


for(int row = 0; row < arrayName.length; row++){
	for(int col = 0; col < sales [ row ].length; col++)
	{
		sales[ row ][ col ] = 0;
	}
}


  Here is another example of a 2D Array that creates a “Itunes” list with artist, album and producer.
 

import javax.swing.*;
import java.util.*;

public class Array2D
{
	public static void main(String[] args)
	{
		String[][] iTunes = new String[3][3];
		iTunes[0][0] = "Artist";
		iTunes[0][1] = "Album";
		iTunes[0][2] = "Producer"; 
		iTunes[1][0] = "50 Cent";
	        iTunes[1][1] = "Curtis";
	        iTunes[1][2] = "G-Unit";
	    
		Scanner input = new Scanner(System.in);
		System.out.printf("%s : %s : %s \n", iTunes[0][0], iTunes[0][1], iTunes[0][2]);
		for(int row = 1; row < iTunes.length; row++)
		{
			for(int col = 0; col < iTunes[ row ].length; col++ )
			{
				System.out.printf("%s : ", iTunes[row][col]);
			}
			System.out.println();
		}
	}

}

/*			System.out.print("Write Artist name: ");
				String artist = input.nextLine();
				iTunes[row][col] = artist;
				
				System.out.print("Write " + artist + "'s album: ");
				String album = input.nextLine();
				iTunes[row][col] = album;
				
				System.out.print("Write " + artist + "'s producer: ");
				String prod = input.nextLine();
				iTunes[row][col] = prod;*/

  

1 Comment

Filed under Programming & Java

Converting & more

 

Dealing with nulls

UtilFactory.convertNull

 

Java – comparing strings

Use == for primitive data types like int

If (mystring == null)

 

Use the equals() method to compare objects

Use .equals for strings  : if (a.equals(“cat”))

 

Continue reading

Leave a Comment

Filed under Programming & Java

Printing out Char writeChar

 If you want to make a method that writes your “char(s)” all out, you cannot do it like you do with toString() method, because char is different. You have to create the System.out.println inside the method it self. so Do not use the return char thing.

public class CharTest
{
  public static void main(String [] args)
  {
     public static void writeChar()
      {
       for(int i = 0; i < charArray.length; i++)
        {
           System.out.println(charArray[i]); // prints every char there is....
         }
       }
   }
}

Remember to call the writeChar method from another class… so it can run

Leave a Comment

Filed under Programming & Java

Constructor ( With/Without ) Parameter & Method

What is a method?

A Method provides information about, and access to, a single method on a class or interface. The reflected method may be a class method or an instance method (including an abstract method).

Method example : getName(); // This will return the name value.so getName have to be getName() { return name; }
They cannot be declared in a public static void main(String[] args) ! but outside.
You have to create them in a public class { } call them from another class or same:)

Constructors – They create new objects and give them values when created if it is with a parameter.

House myHouse = new House(“Red”, 03, “Millad”)
House color, house Number, house owner – > These will be taken when created and saves it to its object…

Without parameter:House myHouse = new House(); This will make a default value that you have to write before creating a “default” class.
like HouseOwner = “Not Set”;

1 Comment

Filed under Programming & Java

Making “connection” between classes

Let say you have two classes and you want to connect them.First make two classes to connect. 

class Test1
{     
      public static void main (String [] args)      
       {
             int number = 1;
       }
}

 As you can see you have a class called Test1, All names of classes should be started with a capital letter.
Make a new class, lets call that Test2

class Test2
{
  Test1 nameThisNewThing = new Test1; // this makes a "connection" so you can get info from the class Test1 threw the name you gave it.
}
 
From there you can get information and send information, because its values or info is not static so you have to create a “new” object out of the class to access it.
Correct me if Im wrong!

1 Comment

Filed under Programming & Java

public static methods !

Static methods is used so it cud be used from other classes without making a new object out of the class it self. So let say you have a static vale of 10, and you want to share it with the other class, you simply call the class name and then the method that returns its value, like this: className.methodName();

now this task is done with two classes, it will generate random arrays that holds 12 arrays, and will put in randomized order {u,h,b) shortcut in norwegian as uavgjort, borte, hjem.

import java.util.Scanner;
public class Tipping 
{
	static Scanner input = new Scanner(System.in);
	private static int feil = 0;
	private static int antall = 0;
	private static char dinGjett = 0;
	static char[] tegnene = new char[ 12 ];
	private static char[] dinTegn = new char[ tegnene.length];
	private static char[] str = new char[] {'H','U','B'};
	
	public static char tippingEnkeltRekke(char[] tegnene)
	{
		for( int i = 0; i < tegnene.length; i++ )
		{
			tegnene[i] += str[(char)(Math.random () * str.length)]; // Generate and place it random back to the list...
		}
		
		
		return 0;
	}
	
	public static char Min()
	{
		for(int i = 0; i < dinTegn.length; i++)
		{
			System.out.print("Din Gjett ( " + i +  " ) Skriv din liste 12 Gjett FORVENTET:  " );
			String gjett = input.next();
			dinGjett = gjett.charAt(0);
			dinTegn[i] += dinGjett;	
		}
		return 0;
	}
	
	public static int sjekkGevinst()
	{
		for(int i = 0; i < tegnene.length; i++)
		{
				if(tegnene[i] == dinTegn[i])
					{
						antall++;
					} else
						feil++;
		}
		return 0;
	}
	
	
	public static void skrivTipperekke()
	{
		for( int i = 0; i < 12; i++)
		{
			System.out.printf("\n%c%15c", tegnene[i], dinTegn[i]); // Print out all char list...
		}
		System.out.println("\nAntall Riktig Match: " + antall + "\nAntall Feil: " + feil);
		
	}

}// end of Tipping class.

Now the second class witch runs the program-

public class TippingManager
{
	public static void main(String[] args)
	{
		
		Tipping.tippingEnkeltRekke(Tipping.tegnene); // Generate the list random...
		
		Tipping.Min();
		Tipping.sjekkGevinst();
		Tipping.skrivTipperekke(); // SKriv ut alle TippeRekkene... 
	}

}

Leave a Comment

Filed under Programming & Java