Owner: Another Computers Blog URL:http://akomaenablog.blogspot.com Join Date: Tue, 17 Jun 2008 09:30:35 -0500 Rating:0 Site Description: JAVA and C programming examples and advices. Tips about computing. Also few MIPS examples and advices about assembly. Site statistics:Click here
C Program to execute shell script 2008-06-17 08:10:46 As I promised in my previous post Suse Linux View CPU speed and Hard disk/CPU temperature I am back to publish my little C program which executes the script
. Actually I extended it a little so it can execute any script witch is given as argument and it is located in the same directory with the executable (after compiling the code below).Well,The first think needed was how to execute a script.I fir Read more:Program
Summer Computer Tips 2008-06-17 07:11:49 #1 – SummerComputer
TravelHoliday travelers should be on alert when arriving home from long weekends, such as the Fourth of July, a popular time for computer viruses to spread. Most computer users have a tendency to turn off their computers when away on trips, which means you’re not getting newly-released anti-virus patches or anti-spyware updates; the two most common areas that cause compute
Use your gmail space as a local drive to store your files 2008-06-10 12:03:55 How can I use my Gmail space to save any file I want?The answer is very very simple and exciting!!!!Download and install GMail Drive Shell ExtensionAfter installing open My Computer folder and you will see another drive
appear named GMail Drive as shown in the image below.You can use it as a normal drive (like C:\)!Double click to open and you will get a window telling you to login.Fill in your go Read more:files
Elapsed time in C 2008-06-05 15:52:21 Here you will see some ways to calculate elapsed time or execution time or real time of a program, procedure,function,whatever.... This is an example of calculating elapsed time with three different ways in C programming language.First way is to use the gettimeofday() function. This function works in Linux but not in Windows by default. That's the reason I commented the code which calculate elapse
Suse Linux View CPU speed and Hard disk/CPU temperature 2008-06-05 15:50:37 I have a laptop which sometime goes really hot and I wanted a simple way to be able to view CPU and Hard disk temperature. I' m on SUSE 10.3 and I tried installing LM-sensors but no sensors were detected. After a very little search I found that you can view the CPU speed by using the cpufrequtils so I installed the package using Yast and executed cpufreq-info.Here is the output:cpufrequtils 002: Read more:Linux
C Example to Reverse a file 2008-05-30 11:35:56 This an example how to reverse a file. It is based on recursion.The idea is to read all the file and when you reach the end(EOF) print them.#include <stdio.h>#include <stdlib.h>void reverse(FILE * file) { int fscanf_return_value; char x; /* read a char */ fscanf_return_value = fscanf(file,"%c",&x) ; if(fscanf_return_value == EOF) { //fscanf returns EOF as the END OF FILE return; } rev Read more:Example
, Reverse
Microsoft Word 2003 does not print page border 2008-05-29 04:42:23 As the title says today I had a problem with Microsoft
word. The page border wasn't printed correctly. Here are the steps to correct it(At least worked for me)Go to:- File menu- Page Setup...- Select the tab Paper- Down the Paper Size select Custom Size- and set Width = 21cm and height = 29cm- Down to Preview select Apply to Whole Documentand click okThat worked for me, the page border was printed Read more:Microsoft Word
Nec ND-6650A Read Error Fixed 2008-05-13 14:06:49 I recently came across a reading problem of my nd 6650A dvd-rw drive.My dvd is a Nec ND6650A and my laptop is Fujitsu Siemens Amilo M series.My dvd-rw drive wasn't able to read a lot of dvds (both DVD-R and DVD+R).I burned some dvds with importand to me data using nero burning software. I also run data verification for every disc and all finished successfuly.After that my ND6650A couldn't read the Read more:Fixed
Simple Java Menu 2008-05-07 08:51:02 This is another simple Java example on how to implement a console menu interface with the user.The steps are really simple. In a loop: a) A String which contains the menu options is printed. b) A number from keyboard is read. c) Using switch - case statement the correct method is called.The following Java code is showing the above steps.import java.util.Scanner;public class Simple
Menu {
MIPS Recursive Fibonacci 2008-04-11 03:22:35 As you may seen I posted an implementation of Fibonacci in C(recursive and not).I have also posted Mips Non Recursive Fibonacci.Here is the recursive implementation of Fibonacci for MIPS. I have already told this, I suggest you use SPIM to simulate your MIPS programs first..datamsg1:.asciiz "Give a number: ".text.globl mainmain:li $v0,4la $a0,msg1syscall #print msgli $v0,5syscall #read an intadd $
MIPS NON recursive Fibonacci 2008-04-11 03:17:05 MIPS NON recursive FibonacciAs you may seen I posted an implementation of Fibonacci in C(recursive and not) and Recursive Fibonacci MIPS.You may also want to see All my MIPS examples.Here is the NON recursive implementation of Fibonacci for MIPS..datamsg1:.asciiz "Give a number : ".text.globl mainmain:li $v0,4la $a0,msg1syscallli $v0,5syscalladd $a0,$v0,$zerojal fibadd $a0,$v0,$zeroli $v0,1syscall
Excecution time in Java 2008-04-08 09:01:30 I am going to write my answer to the question " HOW DO I CALCULATE ELAPSED TIME IN JAVA ?"As far as I now there are two simple ways to calculate the elapsed time - excecution time in JAVA programming language.Java gives two methods ,nanoTime() and currentTimeMillis() both declared in class java.lang.System .currentTimeMillis() returns the current time in milliseconds (long) and (as expected) nano
Fibonacci in C 2008-04-04 03:44:21 This code calculates the Fibonacci of a number inputted by user. Calculation is done with recursion and not.Fibonacci is declared as followed: fibonacci(n) = fibonacci(n-1) + fibonacci(n-2) n>=2 fibonacci(0) = 0 fibonacci(1) = 1Here is the source code of Fibonacci in C:#include <stdio.h>int fibonacci(int y){ if (y==0) return 0; if (y==1) return 1; return( fibonacci(y-1)+
Simple MIPS counter 2008-04-04 03:28:25 This a simple MIPS program. User is asked for a number. If user gives a number from 1 to 20 then the program prints all the numbers from 1 to the number the user inputed.If user gave a number out of range program asks again for a valid number.The same program in C is here..datastr1: .asciiz " Please give an integer from 1 to 20 : "errormsg: .asciiz " Out of range (1-20). \n"nline: .asciiz "\n" # Read more:Simple
MIPS power X^Y example 2008-04-04 03:27:48 Calculate the X raised to the power
of Y. X and Y are read from user input and also X must be from 1 to 20 and Y must be from 0 to 5. To understand better the following MIPS code you may read Calculate power X^Y in C example.This is the MIPS code:.datastr1: .asciiz "Give integer X from 1 to 20 "str2: .asciiz "Give integer Y from 0 to 5 "errormsg: .asciiz "Out of range.\n"nline: .asciiz "\n"result1
Calculate power X^Y in C 2008-04-04 03:27:31 A simple program in C programming language which asks from user to input two numbers (X,Y) and then calculates the result of X raised to the power
of Y. Calculation is done with recursion and not and prints both results which of course must be the same! Maybe you want to see the code of MIPS power X^Y example.Here is the code for the C power example:#include <stdio.h>/* power recursive re
Simple Counter in C 2008-04-04 03:07:43 This is a very simple program in C. User is asked for a number. If user gives a number from 1 to 20 then the program prints all the numbers from 1 to the number the user inputed.If user give a number out of range program asks again for a valid number.This program is here so reader can understand better how this little program is written in MIPS code. The same in MIPS code is here.#include <stdi Read more:Simple
, Counter
VHDL Counter 2008-04-03 04:40:30 This is a VHDL counter which uses VHDL n-input AND gate , VHDL n-input OR gate and VHDL D-Flip Flop.Counter
has the following stages: 0, 1, 2, 6, 7, 10, 12, 13, 14, 15 and 0 again.Stages 3, 4, 5, 8, 9, 11 are not used. Counter has auto correction, which mean if the circuit go to an invalid stage after some clock ticks will go back to a valid stage. Below are the VHDL structural description and ins
VHDL n-input AND gate 2008-04-03 04:11:52 VHDL n-input
AND gate.----------------------------- AND n-input -----------------------------LIBRARY IEEE;USE ieee.std_logic_1164.all;ENTITY andn ISGENERIC (n : INTEGER := 4);PORT (x : IN STD_LOGIC_VECTOR(1 TO n);f : OUT STD_LOGIC);END andn;ARCHITECTURE dataflow OF andn ISSIGNAL tmp : STD_LOGIC_VECTOR(1 TO n);BEGINtmp <= (OTHERS => '1');f <= '1' WHEN x = tmp ELSE '0';END dataflow;You may
VHDL n-input OR gate 2008-04-03 04:10:55 VHDL n-input
OR gate.--------------------------- OR gate n-input ---------------------------LIBRARY IEEE;USE ieee.std_logic_1164.all;ENTITY orn ISGENERIC (n : INTEGER := 4);PORT (x : IN STD_LOGIC_VECTOR(1 TO n);f : OUT STD_LOGIC);END orn;ARCHITECTURE dataflow OF orn ISSIGNAL tmp : STD_LOGIC_VECTOR(1 TO n);BEGINtmp <= (OTHERS => '0');f <= '0' WHEN x = tmp ELSE '1';END dataflow;You may also