Tuesday, July 2, 2013

Solving ArtifactTransferException error

If you get error  "ArtifactTransferException: Failure to transfer commons-logging:commons-logging:jar:1.1.1 from http://repo.maven.apache.org/maven2 was 
 cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced. Original 
 error: Could not transfer artifact commons-logging:commons-logging:jar:1.1.1 from/to central (http://repo.maven.apache.org/maven2): No 
 response received after 60000" while using maven in eclipse, you can solve this problem following steps:
1. Right click the project
2. Goto Maven
3. Click the "Update Project"

Then the error will go.

Thursday, May 16, 2013

Matrix multiplication using mysql

Assume that there are two tables t1 and t2 containing cell values 
of two matrices on each.

For example : 
In table, the data is stored as follows :
 
row  col  value
0    0    5
0    1    2
1    0    5
1    1    9
 
This query can be used to do matrix multiplication:
 
select t1.r row,t2.c col,sum(t1.v*t2.v) value
from t1 join t2 on (t1.c=t2.r) 
group by t1.r,t2.c; 

Friday, April 26, 2013

Go to another page using javascript

window.location.href = url; 

This line of code can be used to go to another page without using <a> (anchor tag). This line of code is placed in some javascript function and the function is called on an event.


Example:

<!doctype html>
<html>
<head>
<title>test</title>
<script>
function goto(){
window.location.href="http://www.google.com";
}
</script>
</head>
<body>
<button onclick="goto();">on google</button>
</body>
</html>