Friday, February 7, 2014

Android Vibration Class Example Code

How do we vibrate android phone? How should we use vibration class? If you looking for this answers look at the following link. Download full source code and see how we do it!.

Read More

Printing Text in Java - Code Example

This post contains a java code that prints a few sentences.

import java.awt.JobAttributes;
import javax.swing.JOptionPane;

public class Main {
 public static void main(String argS[]) {
  System.out.println("Hello World!");
  System.out.print("Welcome to Java Programming!");
  System.out.println(" This is a line following above line!.");
  JOptionPane.showMessageDialog(null, "Welcome to \n Java Programming!");


Read More

Addition Example with Java

This post contains a java code that adds two input entered by the user and show the result.

import java.awt.JobAttributes;

import javax.swing.JOptionPane;

public class Addition {
 public static void main(String args[]) {
  String number1, number2; 
  Integer num1,num2,sum; 
  number1 = JOptionPane.showInputDialog("Enter first number:");
  number2 = JOptionPane.showInputDialog("Enter second number:");
  num1 = Integer.parseInt(number1);
  num2 = Integer.parseInt(number2);
  sum = num1 + num2; 
  JOptionPane.showMessageDialog(null, "The sum is "+sum,"Results",JOptionPane.INFORMATION_MESSAGE);

Read More

Thursday, February 6, 2014

Simple Alarm with Shell Script

In this post, we are going to develop a simple alarm with shell scripts.

To get the time we use date command. To play a sound file we use aplay command-line player. It is also a recorder. Since we are developing an alarm it must control the time continuously so we need an infinite loop. Source codes are given in the following.

Source Codes: 
# Purpose: Demo date command 
# Author: Mustafa Demir

while :
     echo "Press [CTRL+C] to stop.."
     now=$(date +"%H:%M")
     echo "Current time : $now"

     echo " is current time true ?"

     if [ "$now" == "08:06" ]; then
     echo "Yes!"
     aplay sample.wav
     echo "No!"


By changing the controlled time and sample.wav you can adjust it as you want.
Read More

Saturday, December 14, 2013

Transmission Line Analysis Using Matlab

Matlab has a Radio Frequency Toolbox(rf toolbox). Using this toolbox matlab allows us to do some simulation and calculations about transmission lines, active components, RLC components, black box elements etc. In this post we are going to analyze a microstripline using 'rfckt.microstrip' class in the matlab.

Let's calculate characteristic impedance of a microstrip line at 1Ghz, 2Ghz and 3Ghz with the given specifications below:

thickness = 5.000e-09
width = 4.000e-04
height = 3.000e-04

To do the given task we can write the following m file and execute it. The output of the matlab is given below the codes.

% written by Mustafa DEMİR -
%Dec 14, 2013 

mstrpline = rfckt.microstrip('Thickness',5.000e-09,'Width',4.000e-04,'Height',3.000e-04);

analyze(mstrpline,[1e9 2e9 3e9]);

Matlab Command Window Output:

Read More