Monday, March 16, 2009
XP Pro logs off immediately after you log in
Problem: Computer Logs off out when you login
Cause: Search Assistant (search bar aside the clock in windows)
3 Steps.
1.- Get into the recovery console (with boot disks, you can get them from microsoft page).
2.- Get the file userinit.exe from another NOT INFECTED computer. (located in windows/system32 folder)
3.- Overwrite the userinit.exe original file (from the infected computer) with the new one (use a cd or disk to transport it) (COMMAND: COPY e:/userinit.exe c:/windows/system32/userinit.exe)
4.- Rename the userinit.exe to wsaupdater.exe
5.- Exit and ENJOY.
Source : http://www.opentechsupport.net/forums/archive/topic/20552-1.html
Friday, March 13, 2009
Solving equation of three variables in Matlab
8x-2y+5z=10
-2x+10y-3z=0
-5x-3y+10z=0
we can solve the equation in Matlab in the following way. Write simply in the command window :
A=[8 -2 5; -2 10 -3; -5 -3 10]; % a 3x3 matrix
b=[10;0;0]%a 3x1 matrix, be careful not to forget the two semicolons they mean break to the next row in matrix
temp=inv(A)*b % temp will be a 3x1 matrix and contains your answer :-)
x=temp(1)
y=temp(2)
z=temp(3)
Thursday, March 12, 2009
Changing the language in Mac
I just went into Apple sign from the toolbar, System Preferences, and then International. There I chose English as my language for Order for stored lists. I should mention I have Mac OSX 10.5.5.
iApple ;-)
Tuesday, March 10, 2009
IMAP vs. POP
Source : http://www.stanford.edu/services/imap/firstday.html
Lexial structure
I have started to read a little bit about Javascript on the way home in the subway and I thought maybe some people around the world might wonder about this phrase.
Cheers ...
Shahab, Oslo, 7:55 A.M., just got to work ;-)
Thursday, March 05, 2009
Shutdown shell commands for Ubuntu
sudo shutdown -P now
----------------
Restart command :
sudo reboot
Thursday, February 19, 2009
Testing EOF of DataInputStream JAVA
import java.io.DataInputStream;
import java.io.FileInputStream;
import java.io.IOException;
public class TestEOF {
// Throw exceptions to console:
public static void main(String[] args) throws IOException {
DataInputStream in = new DataInputStream(new BufferedInputStream(
new FileInputStream("TestEOF.java")));
while (in.available() != 0)
System.out.print((char) in.readByte());
}
} ///:~
Source
Tuesday, January 20, 2009
Shahabinary Alpha 0.002
Shahabinary English to Norwegian dictionary :
Shahabinary is a OS free, freeware PC application which is at least runable on Linux & Windows

Again I repeat the words and database are not trustable and this is just an exercise in my learning progress. This project the focus is mostly on the technical part and not the dictionary parts of the application.
Click here to download the latest Shahabinary ...
Enjoy ...
Friday, January 16, 2009
Opening text file in word from a java program
Thursday, January 08, 2009
How to run an exe file from java
Runtime.getRuntime().exec( "myprog.exe" );
will spawn an external process (usually a program written in some language other than Java) that runs in parallel with the Java execution. In W95/W98/Me/NT/W2K/XP/W2K3, you must use an explicit *.exe or *.com extension on the parameter. In Vista it will still work even if you leave it off. Be careful to include it, or your code will mysteriously fail on the older operating systems.
It is also best to fully qualify executable names so that the system executable search path is irrelevant, and so you don’t pick up some stray program off the path with the same name.
-----
ATTENTION : Starting with JDK 1.5, exec has been replaced by ProcessBuilder. start. You should likely not be using exec for new programs. However, studying exec is useful to understand old programs that use exec and to understand why ProcessBuilder is designed the way it is. They have many things in common, especially the way command interpreters and internal commands must be handled, and they both use the same Process class. So read about exec first, then enjoy the improved ProcessBuilder.
example :
/ using ProcessBuilder to spawn an process
ProcessBuilder pb = new ProcessBuilder( "dolunch.exe", "firstarg", "secondarg" );
Map
// insert set FRUIT=strawberry into environment just for our children
env.put( "FRUIT", "strawberry" );
// remove set LIVERCOURSE=YES from environment just for our children
env.remove( "LIVERCOURSE" );
// modify set WINE=pinot to WINE=pinot blanc
env.put( "WINE", env.get("WINE") + " blanc" );
// set up the working directory.
// Note the method is called "directory" not "setDirectory"
pb.directory( new File( "/lunchDir" ) );
// merge child's error and normal output streams.
// Note it is not called setRedirectErrorStream.
pb.redirectErrorStream( true );
Process p = pb.start();
// From here on it, it behaves just like exec, since you have the
// exact same Process object.
// ...
// You can reuse the ProcessBuilder objects.
// They retain their initialisation.
Process sister = pb.Start();
SOURCE
reqading txt files with UTF8 formats
java.io.FileInputStream fis=new java.io.FileInputStream(
"File Path");
java.io.InputStreamReader isr=new java.io.InputStreamReader(
fis, "UTF8");
java.io.BufferedReader fin=
new java.io.BufferedReader(isr);
String line;
while((line=fin.readLine())!=null){
//Statements
}//end of while
How do I right-align a JTextField?
myTextField.setHorizontalAlignment(SwingConstants.TRAILING);
Tuesday, January 06, 2009
Finally Shahabinary Alpha 0.001 is ready :-)
Click HERE to download.
Wish me luck and enjoy...
Shahab.
How to make an iterator for a Hashmap in Java
Iterate through the values of Java HashMap example :
/* Iterate through the values of Java HashMap example This Java Example shows how to iterate through the values contained in the HashMap object. */ import java.util.Collection; import java.util.HashMap; import java.util.Iterator; public class IterateValuesOfHashMapExample { public static void main(String[] args) { //create HashMap object HashMap hMap = new HashMap(); //add key value pairs to HashMap hMap.put("1","One"); hMap.put("2","Two"); hMap.put("3","Three"); /* get Collection of values contained in HashMap using Collection values() method of HashMap class */ Collection c = hMap.values(); //obtain an Iterator for Collection Iterator itr = c.iterator(); //iterate through HashMap values iterator while(itr.hasNext()) System.out.println(itr.next()); } } /* Output would be Three Two One */
Saturday, December 20, 2008
Install flash player on ubuntu
Q. How do I install Flash Player for Firefox web browser under Ubuntu Linux?
A. First, close running Firefox.
Open the terminal (shell prompt)
Type the following command to install flash player:
$ sudo apt-get install flashplugin-nonfree
Now flash player should be working. Visit youtube or any other site to view flash content.
Troubleshooting tip
Update: This issue only relevant to older Ubuntu Linux version such as 6.04.
Some people may find voice is not working with newly installed flash player. Type following commands to solve this problem (thanks to macewan.org):$ sudo apt-get install alsa-oss
$ gksudo gedit /etc/firefox/firefoxrc
Find line that read as FIREFOX_DSP and set to:FIREFOX_DSP="aoss"
Save and close the file.
Close Firefox and restart it again.
Click here to see the source.
Monday, December 01, 2008
Linux on USB memory stick
The following Linux distributions are supported by Unetbootin:
- Ubuntu, Kubuntu, Xubuntu
- Debian
- Linux Mint
- opensuse
- Arch Linux
- Damn Small Linux
- Slitaz
- Puppy Linux
- FreeBSD
- NetBSD
- Fedora
- PCLinuxOS
- Gentoo
- Zenwalk
- Slax
- Dreamlinux
- Elive
- CentOS
- Mandriva
- FaunOS
- Frugalware Linux
Ubuntu 8.10 offers a way to create a USB drive from the Live CD or an .iso. The question is, how well does this really work. In order to test we created several of these USB drive installs. The first thing to note is that the process is easy to do. Here is a step by step in create a USB Pen Drive disk.
Insert the USB Pen Drive once you have booted the Live CD. Now go to System/Administration and Create USB startup disk in the menu. You will see it has detected the 2 GB San Disk. You can use as small as 1 GB for the disk. You will also need to indicate the location of the Live CD or an .iso so the system can build the disk. Here we used the Live CD.
It provides you with the option to decide how much free space to allow for files that you create. What this does is give you a way to move this Pen Drive from computer to computer and save your files. A mobile Pen Drive.
Installation process is quick.
News source (NORWEGIAN) : http://www.hardware.no/artikler/kjor_linux_fra_minnepinnen/58108
Tutorial Source : http://beginlinux.wordpress.com/2008/11/18/ubuntu-810-usb-drive-review/
Tuesday, November 11, 2008
VLC doesn't show subtitle automaticly under Linux
You click on open file, you specify the video file, then you click on use subtitle file, and then specify the subtitle file, it does not have to have the same name, as long as you specify the correct path
also, the subtitles file might be wrong, try to open it with a text editor and check its contents.
also try opening another subtitles, just to make sure that the subtitles file is not corrupted/worng.
Source that helped me : http://ubuntuforums.org/archive/index.php/t-803063.html
Monday, November 10, 2008
How to set JAVA_HOME variable
A : ~/.bash_profile is a startup script which generally runs once. This particular file is used for commands which run when the normal user logs in. Common uses for .bash_profile are to set environment variables such as PATH, JAVA_HOME, to create aliases for shell commands, and to set the default permissions for newly created files.
Set JAVA_HOME / PATH for single user
Login to your account and open .bash_profile file$ vi ~/.bash_profile
Set JAVA_HOME as follows using syntax export JAVA_HOME=export JAVA_HOME=/usr/java/jdk1.5.0_07/bin/java
Set PATH as follows:export PATH=$PATH:/usr/java/jdk1.5.0_07/bin
Save and close the file. Just logout and login back to see new changes:$ echo $JAVA_HOME
$ echo $PATH
Tip: Use the following command to find out exact path to which java executable under UNIX / Linux:$ which java
Please note that the file ~/.bashrc is similar, with the exception that ~/.bash_profile runs only for Bash login shells and .bashrc runs for every new Bash shell.
Set JAVA_HOME / PATH for all user
You need to setup global config in /etc/profile OR /etc/bash.bashrc file for all users:# vi /etc/profile
Next setup PATH / JAVA_PATH variables as follows:export PATH=$PATH:/usr/java/jdk1.5.0_07/bin
export PATH=$PATH:/usr/java/jdk1.5.0_07/bin
Save and close the file.
Source : http://www.cyberciti.biz/faq/linux-unix-set-java_home-path-variable/
Friday, November 07, 2008
Schematic Diagrams, DC circuits






--------------------------------------------------------------
1. Ohm's Law deals with the relationship between voltage and current in an ideal conductor. This relationship states that:
The potential difference (voltage) across an ideal conductor is proportional to the current through it.
The constant of proportionality is called the "resistance", R.
Ohm's Law is given by:
- V = I R
- I = g V
3. Ohm's Law can be used to solve simple circuits. A complete circuit is one which is a closed loop. It contains at least one source of voltage (thus providing an increase of potential energy), and at least one potential drop i.e., a place where potential energy decreases. The sum of the voltages around a complete circuit is zero.
4. An increase of potential energy in a circuit causes a charge to move from a lower to a higher potential (ie. voltage). Note the difference between potential energy and potential.
Because of the electrostatic force, which tries to move a positive charge from a higher to a lower potential, there must be another 'force' to move charge from a lower potential to a higher inside the battery. This so-called force is called the electromotive force, or emf. The SI unit for the emf is a volt (and thus this is not really a force, despite its name). We will use a script E, the symbol , to represent the emf.
A decrease of potential energy can occur by various means. For example, heat lost in a circuit due to some electrical resistance could be one source of energy drop.
Because energy is conserved, the potential difference across an emf must be equal to the potential difference across the rest of the circuit. That is, Ohm's Law will be satisfied:

Source : http://www.physics.uoguelph.ca/tutorials/ohm/