Sunday, April 27, 2008

My Timer Label Swing Component

For sometime I wanted to create a swing component and for some business issues I wanted to calculate time I worked to calculate my payments. So I created a program that counts time in milliseconds. Then I wanted to create the same program with more features and thought if some other programs may need such component. Here comes the idea of extending Java Swing JLabel component to have the time counter then use it whenever possible and distribute it for other developers.

You can download the component from the link: http://www.4shared.com/file/45525258/ea7339d0/TimerLabel.html

NetBeans is recommended for development. You can add the component by adding it to the palette of swing by using the palette manager the "Add from jar" and select my jar file which contains TimerLabel class which represents the component.

The component contains three main functions:
  • start(): which starts the timer.
  • pause(): pause the running timer.
  • reset() resets the timer to zero state.
you can find further documentation in doc folder.

Wednesday, April 16, 2008

Slow Linux Internet? Here is a solution

Some distribution such as Debian etch enable IPv6 by default (I don't know why to use IPv6 now). This may cause the internet connection to slow down as the system searches for IPv6 first and most of internet connections uses IPv4 (which is the appropriate one).

To fix this problem you need to edit file /etc/modprobe.d/aliases to disable IPv6 support. Edit the file and search for the line:

alias net-pf-10 ipv6
and edit it to be:
alias net-pf-10 off #ipv6

Then reboot your machine to enable new settings and enjoy flawless speed.

Sunday, April 22, 2007

My own distro screenshots


This is some screen shots for my own Linux distribution which I've built from scratch.

Tuesday, April 10, 2007

How to think like a computer scientist

This is a series of books for different programing languages including C++, python and Java. It is a very good series that focuses on how the programmer should think including using different data structures and developing methods. the series' books could be found at:
C++: http://ibiblio.org/obp/thinkCS/cpp/english/dist/thinkCScpp.html.tgz
Python: http://ibiblio.org/obp/thinkCS/python/english2e.tgz
Java: http://ibiblio.org/obp/thinkCS/java/english/dist_v4.0/thinkapjava.pdf

Wednesday, April 4, 2007

A lot of java examples

http://www.exampledepot.com/

This site offers a lot of Java examples on almost every class of J2SE. It includes also HowTOs to perform different tasks using thse classes I hope you Enjoy it.

Monday, March 5, 2007

Bad User

I've heard a lot of people saying that their hared disks was damaged because of trying to setup Linux or so. At last few days It was approved that not the OS which is the real problem but the problem is the bad use of the OS tools.

For example a check disk tool for windows damaged my most valuable partition with my most valuable data. I'm sure that I was the real cause. The story begins after a forced check disk at the startup of the Windows OS in a dual boot machine with Windows XP SP2 and Fedora Core 6. After the check I found no data on the partition. I've tried several times to restore the data but failed. Then I thought to use fsck.vfat utility in Linux the data was restored perfectly, so I restored some data into CDs and other partitions. After rebooting to Windows again it forced the check disk another time and returned to the starting point. I tried again to use Windows chkdsk to restore my data one of my tries ended with all data on the partition lost.

What I want to say is that the OS isn't the main reason for destroying data and hard disks but the main problem is the bad use of tools that may lead into lose of data. So don't accuse any tool of your bad use. At the end and beginning I thank my god that I've restored my most most important data.

Tuesday, February 6, 2007

The beginning

Welcome back,

I just want to start my tutorials of c++. To start a compiler, the program that translates source code into executable or runnable format that can be executed, is needed. My preferred compiler is GCC which is GNU Compiler Collection which is a collection of compilers for various languages, basically c and c++. It is shipped by default with most Linux distributions. A version for Microsoft Windows is available from the site http://www.mingw.org. Also an Integrated Development Environment, IDE, is available with a version of this compiler from http://www.bloodshed.net.

The installation of the compiler is so easy. for Linux it may be installed by default for most distribution if it is not you can install it using your distro program installation instruction. for example:

for Debian or Ubuntu as root:

apt-get update
apt-get install gcc g++

For Microsoft windows just run the installation program and follow install instructions.

The start will be with console applications, application that runs from the command line and uses only monitor as output and keyboard as input. Those applications will be used to learn the basics of the language and programming in general. Then we may advance to programming Graphical User Interface (GUI) based application using the QT library, an open source library for developing GUI applications, to know the basics of GUI applications.