Ultrahack 2015

Sorry for the delay in the posts. Not that a lot of people read this anyway but the reasons are that once you stop and you are busy; getting back seems like a work in itself.

Here is a little update. I was in the Ultahack 2015 last weekend. The event was the best and seemed to be well organized. My team got chosen based on Code Camp idea and next week we are also going to Slush.

IMG_0681

 

Java – BMI Calculator

After some exhaustion with writing, university and work I am starting to feel a little more better and motivated to start updating this webpage. I am currently working as an IT-Technician in CGI Portugal branch so I am feeling that it would be a nice side hobby just to update the main page with random stuff that I read, encounter or feel like writing about. In no way does the content reflect my skill levels but they are just some basic repeating of the old stuff. I also feel that It will take more time to manage all these different sites rather than writing the content so whenever I feel I will write in the main page and sometimes in the other pages if I feel obligated because the blog is not a professional one but rather a hobby.


 

 

public class BMI {
 /*
   * Underweight = <18.5
   * Normal weight = 18.5–24.9
      * Overweight = 25–29.9
      * Obesity = BMI of 30 or greater
  */
 private double inches;
 
 private double weight;
 
 private double BMI;

 public BMI (double inches, double weight) {
  this.inches = inches;
  this.weight = weight;
  calculate();
 }
 
 public void calculate() {
  this.BMI = weight / (this.inches * this.inches);
  analysis();
 }
 
 public void analysis() {
  if (this.BMI < 18.5) {
   System.out.println(“You are underweight”);
  }
  else if (this.BMI >= 18.5 && this.BMI < 24.9) {
   System.out.println(“You are normal weight”);
  }
  else if (this.BMI >= 24.9 && this.BMI < 29.9) {
   System.out.println(“You are overweight”);
  }
  else if (this.BMI >= 29.9) {
   System.out.println(“You are obese”);
  }
 }
 /**
  * @return the inches
  */
 public double getInches() {
  return inches;
 }

 /**
  * @param inches the inches to set
  */
 public void setInches(double inches) {
  this.inches = inches;
 }

 /**
  * @return the weight
  */
 public double getWeight() {
  return weight;
 }

 /**
  * @param weight the weight to set
  */
 public void setWeight(double weight) {
  this.weight = weight;
 }

 /**
  * @return the bMI
  */
 public double getBMI() {
  return BMI;
 }

 /**
  * @param bMI the bMI to set
  */
 public void setBMI(double bMI) {
  BMI = bMI;
 }

 /* (non-Javadoc)
  * @see java.lang.Object#toString()
  */
 @Override
 public String toString() {
  return “BMI [inches=” + inches + “, weight=” + weight + “, BMI=” + BMI
    + “]”;
 }
}


public class MainProgram {
 public static void main(String[] args) {
  BMI bmi = new BMI(187,80);
 }
}

Personal Web page

As an update I have created an ongoing personal web page project and later I will upload my Java EE Spring MVC demo application. Sorry for the wrong address previously. It should now work.

Edit: This s the fourth update. I had some mix up with DNS. Now it should work. Just copy paste the link below in your browser.

kurosh-farsimadan.com

Java programming – Class/Bean with Constructors, Properties, Setters/Getters and toString method

Employee

 


 

public class Employee {
private int empNum;
private String firstName;
private String lastName;
private String initials;
private char sex;
private String phoneNumber;
private double salary;
private boolean workStatus;

public Employee() {}

public Employee(int empNum,
String firstName,
String lastName,
String initials,
char sex,
String phoneNumber,
double salary,
boolean workStatus) {
this.empNum = empNum;
this.firstName = firstName;
this.lastName = lastName;
this.initials = initials;
this.phoneNumber = phoneNumber;
this.salary = salary;
this.sex = sex;
this.workStatus = workStatus;
}

public Employee(int empNum) {
this.empNum = empNum;

}

public Employee(String firstName, String lastName) {
this.firstName = firstName;
this.lastName = lastName;
}

/**
* @return the empNum
*/
public int getEmpNum() {
return empNum;
}

/**
* @param empNum the empNum to set
*/
public void setEmpNum(int empNum) {
this.empNum = empNum;
}

/**
* @return the firstName
*/
public String getFirstName() {
return firstName;
}

/**
* @param firstName the firstName to set
*/
public void setFirstName(String firstName) {
this.firstName = firstName;
}

/**
* @return the lastName
*/
public String getLastName() {
return lastName;
}

/**
* @param lastName the lastName to set
*/
public void setLastName(String lastName) {
this.lastName = lastName;
}

/**
* @return the initials
*/
public String getInitials() {
return initials;
}

/**
* @param initials the initials to set
*/
public void setInitials(String initials) {
this.initials = initials;
}

/**
* @return the sex
*/
public char getSex() {
return sex;
}

/**
* @param sex the sex to set
*/
public void setSex(char sex) {
this.sex = sex;
}

/**
* @return the phoneNumber
*/
public String getPhoneNumber() {
return phoneNumber;
}

/**
* @param phoneNumber the phoneNumber to set
*/
public void setPhoneNumber(String phoneNumber) {
this.phoneNumber = phoneNumber;
}

/**
* @return the salary
*/
public double getSalary() {
return salary;
}

/**
* @param salary the salary to set
*/
public void setSalary(double salary) {
this.salary = salary;
}

/**
* @return the workStatus
*/
public boolean isWorkStatus() {
return workStatus;
}

/**
* @param workStatus the workStatus to set
*/
public void setWorkStatus(boolean workStatus) {
this.workStatus = workStatus;
}

/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
return “Employee [empNum=” + empNum + “, firstName=” + firstName
+ “, lastName=” + lastName + “, initials=” + initials
+ “, sex=” + sex + “, phoneNumber=” + phoneNumber + “, salary=”
+ salary + “, workStatus=” + workStatus + “]”;
}
}

Useful IT-support tools, tips and command promt commands

Sorry for not updating the blog for a very long time, because of the internship and not having enough time. Below I have posted a few useful commands, tips and tools to use that I have learned for example if you are a sales manager and need to keep your wireless printer online (Some printers have so called “Eco” mode or in another words it, goes on a sleep mode), because some workers might not have the nerves to connect to this printer every time.

The easier way is to use your router and do some configuration to the box but that is a bit more advanced and risky if you are not specialized in the field. You can change your routers settings by plugging the network cable to your computer and just type in the IP address of this router to your browser.

The first command is

ping -t ipAddress

The output should be something like in the picture

output1

What is happening that we are keeping the printer online for the whole day. To do this you will need to have the pinging computer to be online all the time. Another useful command is to use netstat to see what programs are using what ports, if for example you have two simultaneously run programs that use the same port.

If you want for example to block some websites, you have to do the following, but as I have learned in my internship the following is insufficient. Every day you will have a new proxy site and if you do not use a commercial product/company you will have to update this blocklist (router or computer level). If you are using the blocklist on the computer level, please separate the user side from the admin so no one can make any changes to the hosts file.

1. Open your notepad as and administrator i.e. “Run as administrator”.2. Open the hosts file in the Windows –> System32 –> drivers –> etc.
3. Add the IP address and the name of the site. Or just the whole address of the site as in the below block example list.
# Block Facebook

0.0.0.0 http://www.facebook.com

0.0.0.0 facebook.com

0.0.0.0 static.ak.fbcdn.net

0.0.0.0 http://www.static.ak.fbcdn.net

0.0.0.0 login.facebook.com

0.0.0.0 http://www.login.facebook.com

0.0.0.0 fbcdn.net

0.0.0.0 http://www.fbcdn.net

0.0.0.0 fbcdn.com

0.0.0.0 http://www.fbcdn.com

0.0.0.0 static.ak.connect.facebook.com

0.0.0.0 http://www.static.ak.connect.facebook.com

0.0.0.0 https://www.facebook.com

0.0.0.0 http://www.facebook.com

0.0.0.0 https://facebook.com

0.0.0.0 http://facebook.com

0.0.0.0 69.63.176.13

0.0.0.0 69.63.181.15

0.0.0.0 69.63.184.142

0.0.0.0 69.63.187.17

0.0.0.0 69.63.187.18

0.0.0.0 69.63.187.19

0.0.0.0 69.63.181.11

0.0.0.0 69.63.181.12

0.0.0.0 https://m.facebook.com

0.0.0.0 http://m.facebook.com

0.0.0.0 31.13.80.18

0.0.0.0 https://m.facebook.com/?_rdr

0.0.0.0 m.facebook.com/?_rdr

# Block Facebook IPv4

0.0.0.0 http://www.facebook.com

0.0.0.0 facebook.com

0.0.0.0 login.facebook.com

0.0.0.0 http://www.login.facebook.com

0.0.0.0 fbcdn.net

0.0.0.0 http://www.fbcdn.net

0.0.0.0 fbcdn.com

0.0.0.0 http://www.fbcdn.com

0.0.0.0 static.ak.fbcdn.net

0.0.0.0 static.ak.connect.facebook.com

0.0.0.0 connect.facebook.net

0.0.0.0 http://www.connect.facebook.net

0.0.0.0 apps.facebook.com

# Block Facebook IPv6

fe80::1%lo0 facebook.com

fe80::1%lo0 login.facebook.com

fe80::1%lo0 http://www.login.facebook.com

fe80::1%lo0 fbcdn.net

fe80::1%lo0 http://www.fbcdn.net

fe80::1%lo0 fbcdn.com

fe80::1%lo0 http://www.fbcdn.com

fe80::1%lo0 static.ak.fbcdn.net

fe80::1%lo0 static.ak.connect.facebook.com

fe80::1%lo0 connect.facebook.net

fe80::1%lo0 http://www.connect.facebook.net

fe80::1%lo0 apps.facebook.com

# Block Facebook nations

0.0.0.0 it-it.facebook.com

0.0.0.0 http://www.facebook.com

0.0.0.0 ko-kr.facebook.com

0.0.0.0 m.facebook.com

0.0.0.0 es-la.facebook.com

0.0.0.0 th-th.facebook.com

0.0.0.0 fbcdn-dragon-a.akamaihd.net

0.0.0.0 fbstatic-a.akamaihd.net

0.0.0.0 developers.facebook.com

0.0.0.0 id-id.facebook.com

0.0.0.0 vi-vn.facebook.com

0.0.0.0 fr-fr.facebook.com

0.0.0.0 facebook.com

0.0.0.0 es-es.facebook.com

0.0.0.0 pixel.facebook.com

0.0.0.0 fi-fi.facebook.com

#Block Youtube

0.0.0.0   youtube.com

0.0.0.0   http://www.youtube.com

0.0.0.0   208.65.153.251

#Proxy sites

0.0.0.0 http://www.hidemyass.com

0.0.0.0 http://www.anonymizer.com

0.0.0.0 http://www.wujie.net

0.0.0.0 http://www.ultrareach.net

0.0.0.0 http://surfshield.net

0.0.0.0 http://www.guardster.com/subscription/proxy_free.php

0.0.0.0 http://anonymouse.ws/anonwww.html

0.0.0.0 http://www.browser-x.com

0.0.0.0 http://www.spysurfing.com

0.0.0.0 http://www.xerohour.org/hideme

0.0.0.0 http://www.proxyz.be

0.0.0.0 http://www.sc0rian.com/prox

0.0.0.0 https://www.proxify.us

0.0.0.0 http://kproxy.com/index.jsp

0.0.0.0 http://www.brawl-hall.com/pages/proxy.php

0.0.0.0 http://www.proxify.net

0.0.0.0 http://proxy.computersteroids.com/index0.php

0.0.0.0 http://www.unipeak.com

0.0.0.0 http://flyproxy.com

0.0.0.0 http://alienproxy.com

0.0.0.0 http://proxify.com/

0.0.0.0 http://www.unfilter.net

0.0.0.0 http://www.proxymouse.com

0.0.0.0 http://www.surfonym.com/cgi-bin/nph-proxy

0.0.0.0 http://www.superproxy.be/browse.pl

0.0.0.0 http://www.websiteguru.com/mrnewguy

0.0.0.0 http://www.letsproxy.com

0.0.0.0 http://www.fsurf.com

0.0.0.0 http://indianproxy.com

0.0.0.0 http://www.letmeby.com

0.0.0.0 http://Boredatschool.net

0.0.0.0 http://www.ibypass.org

0.0.0.0 http://www.ipzap.com/

0.0.0.0 https://proxify.biz

0.0.0.0 http://kproxy.com/index.jsp

0.0.0.0 http://www.attackcensorship.com/attack-censorship.html

0.0.0.0 http://mrnewguy.com

0.0.0.0 http://www.evilsprouts.co.uk/defilter

0.0.0.0 http://www.proxify.info

0.0.0.0 http://www.torify.com

0.0.0.0 http://www.switchproxy.com

0.0.0.0 http://www.proxifree.com

0.0.0.0 http://www.secure-tunnel.com/

0.0.0.0 http://www.proxify.cn

0.0.0.0 http://www.arnit.net/utilities/webproxy/new

0.0.0.0 http://www.proxify.co.uk

0.0.0.0 http://www.betaproxy.com

0.0.0.0 http://www.proxify.org

0.0.0.0 http://www.proxychoice.com

0.0.0.0 http://www.proxysnail.com

0.0.0.0 http://www.anonypost.com

0.0.0.0 http://www.thestrongestlinks.com

0.0.0.0 http://www.hujiko.com

0.0.0.0 http://www.anonproxy.info

0.0.0.0 http://www.peoplesproxy.com

0.0.0.0 http://www.freeproxy.us

0.0.0.0 http://www.proxyweb.net

0.0.0.0 http://www.nopath.com

0.0.0.0 http://urlencoded.com

0.0.0.0 http://www.pole.ws

0.0.0.0 http://www.browseany.com

0.0.0.0 http://www.spiderproxy.com

0.0.0.0 http://www.clickcop.com

0.0.0.0 http://www.sneakysurf.com

0.0.0.0 http://www.mywebtunnel.com

0.0.0.0 http://www.thewebtunnel.com

0.0.0.0 http://www.3proxy.com

0.0.0.0 http://www.yourfreeproxy.com

0.0.0.0 http://www.proxy7.com

0.0.0.0 http://www.fireprox.com

0.0.0.0 http://www.stupidcensorship.com

0.0.0.0 http://www.letsproxy.com

0.0.0.0 http://www.sneak2.com

0.0.0.0 http://www.cecid.com

0.0.0.0 http://www.freeproxy.ca

0.0.0.0 http://www.ibypass.org

0.0.0.0 http://www.goproxing.com

0.0.0.0 http://www.projectbypass.com/

0.0.0.0 http://www.ipsecret.com

0.0.0.0 http://www.nomorelimits.net

0.0.0.0 http://www.proxify.de

0.0.0.0 http://www.bywhat.com

0.0.0.0 http://www.snoopblocker.com

0.0.0.0 http://www.anonymizer.ru

0.0.0.0 http://www.proxyking.net/

0.0.0.0 http://www.perlproxy.com

0.0.0.0 http://www.proxylord.com

0.0.0.0 http://tntproxy.com

0.0.0.0 http://satanproxy.com

0.0.0.0 http://zombieinvasion.info

0.0.0.0 http://demonproxy.com

0.0.0.0 http://www.myfreeproxy.com

0.0.0.0 http://www.gezcem.com/nph-proxy.pl.old

0.0.0.0 http://mpleger.de

0.0.0.0 http://www.the-cloak.com/login.html

I will try to update the blog and this post as much as possible if I will find the time.

C# – 3 – Dice Program

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DiceProgram
{
class DiceProgram
{
static void Main(string[] args)
{
int guess;
string middleMan;
Console.WriteLine(“Welcome to the Kurosh’s dice program”);
Random random = new Random();

for (int i = 0; i < 200; i++)
{
int die = (int)((random.NextDouble() * 6) + 1);
Console.WriteLine("Computer has generated a random number from 0 – 6");
Console.Write("Try to guess the number on the dice: ");
middleMan = Console.ReadLine();
guess = int.Parse(middleMan);
if (guess == die)
{
Console.WriteLine("You have guessed correctly! The number of the dice was {0}", guess);
}
else if (guess != die)
{
Console.WriteLine("Your guess was wrong! You typed {0} but the computer generated number was {1}", guess, die);
}
Console.WriteLine();
}
}
}
}

C# – 2 – Simple keyboard reader

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

class KeyBoardInputAndOutput
{
public static void Main()
{
Console.TreatControlCAsInput = true;
ConsoleKeyInfo key;

Console.WriteLine(“Press the buttons on the keyboard to see the output”);

do
{
key = Console.ReadKey();
Console.WriteLine(” : is your input.”);
if ((key.Modifiers & ConsoleModifiers.Alt) != 0)
{
Console.Write(“ALT+”);
}
else if ((key.Modifiers & ConsoleModifiers.Shift) != 0)
{
Console.Write(“SHIFT+”);
}
else if ((key.Modifiers & ConsoleModifiers.Control) != 0)
{
Console.Write(“CTL+”);
}

Console.WriteLine(key.Key.ToString() + ” : is system print.”);

} while (key.Key != ConsoleKey.Escape);
}
}